class A{
m2(){
}
}
class B extends A{
m2(){
}
}
class c extends B{
m2(){
}
}
class my_class extends c{
m2(){
}
pulic static void main(){

...My_class a = new my_class();
super.super.super.m2(); is this is leagal
if not find what is the legal procedure in order to call A's
version of m2();

}

Answer Posted / sree

class A{
void m2(){

System.out.println("in class A"); }
}

class B extends A{
void m2(){
super.m2();
System.out.println("in class B");
}
}

class c extends B{
void m2(){super.m2();
System.out.println("in class c");
}
}

class Check extends c{
void m2(){
super.m2();
System.out.println("in check()"); }
public static void main(String[] args){
c obj =new Check();
obj.m2();
}
}

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is main an identifier?

549


How many times finalize method will be invoked? Who invokes finalize() method in java?

578


Is 0 a prime number?

575


What is the difference between compare and compareto in java?

492


What is pangram in java?

517






What happens if main method is not static?

501


Describe string intern() methodology

599


why not override thread to make a runnable? : Java thread

561


How do you end a program?

554


is there a separate stack for each thread in java? : Java thread

544


What is the major drawback of internal iteration over external iteration?

590


What is instance synchronization?

551


Can java list be null?

558


What is a qms manual?

550


What is function overriding and overloading in java?

587