Abstraction
Abstract means theoretical not practical or not implemented.
If we need to watch TV we need not to know how TV works we just switch channels using remote.
Abstract class can be fully and partially implemented Abstract class.
Abstraction means hiding the internal details of implementation.
We cannot create a instance of abstract class
public abstract class BMV {
void commonFunctionality() {
System.out.println("Inside common fun");
}
abstract void acclerate();
}
public class ThreeSeries extends BMV {
@Override
void acclerate() {
System.out.println("Inside 3 series can go upto 120");
}
}
public abstract class FiveSeries extends BMV{
abstract void acclerate();
}
public class Test {
public static void main(String[] args) {
ThreeSeries three = new ThreeSeries();
three.acclerate();
three.commonFunctionality();
}
}
Output - Inside 3 series can go upto 120
Inside common fun
Access modifiers --
we can't mark abstract class as final.
we can't mark abstract method as static.
Top comments (0)