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
Can a static class have a constructor?
What does singleton class mean?
How many types of memory areas are allocated by JVM in java?
How to print nodes of a Binary tree?
Which collection is thread safe in java?
What are thread groups?
What are computer functions?
Which language is java?
Can a class be private or protected in java?
What is a top level class in java?
Can we overload destructor in java?
What is the main use of java?
How do you convert bytes to character in java?
What is the biggest integer?
What is string data?