I want to know how can I access the method of grandparent's in child class as a sequence in with I have written in void main(). I have been facing difficulty in accessing the methods in the sequence of the code. I cannot find anything to make it run smoothly.
import java.util.*;
class first{
void view(){
System.out.println("I am in View");
}
void display(){
System.out.println("I am in First's Display");
}
}
class second extends first{
void show(){
System.out.println("I am in Show");
}
void display(){
System.out.println("I am in Second's Display");
}
}
class third extends second{
void output(){
System.out.println("I am in Output");
}
void display(){
System.out.println("I am in Third's Display");
}
}
class demo{
public static void main(String s[]){
third d = new third();
d.view();
d.display();
d.show();
d.display();
d.output();
d.display();
}
}