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 / santosh subrahmanya

This will work......

class A{
public void m2(){
System.out.println("called...");
}
}

class B extends A{
public void m2(){
super.m2();

}
}

class c extends B{
public void m2(){
super.m2();

}
}

class my_class extends c{
public void m2(){
super.m2();

}

public static void main(String[] args){

my_class a = new my_class();
a.m2();

}
}

Is This Answer Correct ?    10 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is return code?

566


How is hashset defined in java?

528


Where are the card layouts used?

620


What is a vector in java?

582


What is meant by stack and queue?

612






What is ellipsis in java?

591


What is dynamic binding(late binding)?

602


What is boolean law?

528


What about anonymous inner classes in java?

577


What are three ways in which a thread can enter the waiting state in java programming?

692


Which method returns the length of a string?

577


What is the list interface in java programming?

590


What are the steps involved to create a bean?

689


Can a class have 2 constructors?

510


When arithmeticexception is thrown?

591