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 a jagged array in java?
What are the main differences between notify and notifyAll in Java?
Can a final variable be null?
Can we restart a dead thread in java?
What is the use of predicate in java 8?
Which is faster set or list in java?
Can we catch more than one exception in single catch block?
What is a parent class in java?
What does exclamation mean in java?
What is method overloading and method overriding?
How do you read and print a string in java?
Which methods are used during serialization and deserialization process?
is there a separate stack for each thread in java? : Java thread
These static constructors are correct ? class A { statc intA() { } static A(int x,int y) { } static A(int x) { } }
What are the escape sequences in java?