Question: Question 4 Consider the following code snippet: public class Parent { public void display ( ) { System.out.println ( This is the Parent class.

Question 4
Consider the following code snippet:
public class Parent {
public void display(){
System.out.println("This is the Parent class.");
}
}
public class Child extends Parent {
public void display(){
super.display();
System.out.println("This is the Child class.");
}
}
public class Main {
public static void main(String[] args){
Child child = new Child();
child.display();
}
}
What is the output of the above code snippet upon successful execution?
options:
This is the Child class.
This is the Parent class.
This is the Child class.
This is the Parent class.
This is the Parent class.
This is the Child class.

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 Databases Questions!