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
How the interruptible method gets implemented?
Should you use singleton pattern?
What happens if a try-catch-finally statement does not have a catch clause to handle an exception that is thrown within the body of the try statement?
How to check if a list is sorted in java?
What is the technique adopted to create an immutable class?
Can a class have multiple subclasses?
How to sort array in descending order in java?
What is unicode in java?
What is the difference between hashmap and hashtable in java?
What is the purpose of the wait(), notify(), and notifyall() methods in java programming?
Can we extend a class with private constructor?
How does a cookie work in Servlets?
How do you square a number?
What is object english?
What is variable in java?