==================================================
Q. Why abstract method cannot be declared with private?
abstract method: The method which has only declaration butnot implementation.
Child classes are responsible to provide implementation for parent class abstract methods.
private vs abstract:
-----------------------
parent class abstract methods should be visible to the child classes, then only child class can provide implementation.
But private methods are not visible to child classes.
abstract class Vehicle
{
private abstract int getNoOfWheels();
}
class Bus extends Vehicle
{
}
illegal combination of modifiers: abstract and private
#durgasoftware #Java #CoreJava
0 Comments