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
What is constructor in java ?
Can a class extends itself in java?
What is an argument java?
How we can skip finally block of exception even if some exception occurs in the exception block in java?
What means public static?
which one is more efficient int x; 1. if(x==null) 2.if(null==x) state which one either 1 or 2?
How can a gui component handle its own events in java programming?
How use .contains in java?
How to read and write image from a file ?
Is integer immutable in java?
What is the use of math abs in java?
What is the use of join method?
What is the purpose class.forname method?
What is difference between an object and a class?
What super () does in java?