I can make this code work without an object as input parameter for the abstract method. For example, if I make the input parameter for the printInformation()
method in person and emp as printInformation(int x)
it works.
The moment I make the input parameter as an object for printInformation()
method as shown below, it throws an error
emp is not abstract and does not override abstract method printInformation(person) in person class emp extends person{ ^
abstract class person{
abstract void printInformation(person p);
}
class emp extends person{
emp(){
System.out.println("This is a emp constructor");
}
void printInformation(emp e){
System.out.println("This is an emp");
}
}
class entity{
public static void main(String args[]){
emp employeeObject = new emp();
employeeObject.printInformation(employeeObject);
}
}