Question: Consider the Java code snippet below: 1 2 class Base { 3 private void display ( ) { System.out println ( Base display

Consider the Java code snippet below:
1
2
class Base {
3
private void display(){
System.out\ println("Base display()");
5
}
6
8
public class Derived extends Base f
9+
public void display(){
10
System.out-println("Derived display()");
11
12
13
public static void main(String] args){
14
Base obj = new Derived();
15
obj .display();
Will the above code compile and run without any errors, displaying "Derived display)" to the console?

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!