
Abstract Class in Java
Abstract Class in Java
Abstract class is a class which has any or all methods having the declaration only, but not the full functionality written then the whole class itself becomes abstract class.
The class which extends these type of abstract class can write the full funtionality of the methods.
Ways to achieve abstraction in java
Abstract class (0 to 100%)
Interface (100%)
Example :
abstract class Bike { abstract void run(); } class Bajaj extends Bike { void run() { System.out.println("running safely"); } public static void main(String args[]); { Bike obj = new Bajaj(); obj.run(); } } |
Output : running safely |