Question: What will be the output when the above code is executed? Compilation error due to attempting to create an instance of an abstract class Parent

What will be the output when the above code is executed?
Compilation error due to attempting to create an instance of an abstract class
Parent class
Compilation error due to attempting to override a final method
Consider the following code snippet:
public class Parent {
public final void display(){
System.out.println("Parent class");
}
}
public class Child extends Parent {
public void display(){
System.out.println("Child class");
}
public static void main(String[] args){
Child obj = new Child();
obj.display();
}
}Child class
What will be the output when the above code is

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!