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
What is a "pure virtual" member function?
Write a program to print fibonacci series up to count 10.
What is an error in java?
How to sort a collection of custom Objects in Java?
How variables are stored in memory?
What is java util concurrentmodificationexception?
Explain the purpose of garbage collection in Java?
What is meant by anonymous class?
Write a java program for binary search?
What is the purpose of static methods and static variables?
Is the empty set a singleton?
How to use arraylist in java netbeans?
Give the difference between the println method and sqrt method?
What is difference between == equals () and compareto () method?
What happens when main () method is declared as private?