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
worst case complexities of Quick sort and Merge sort.
How many types of flags are there?
What are the 6 mandatory procedures for iso 9001?
Convert Binary tree to linked list.
Define how destructors are defined in java?
What does serializing data mean?
Which of the classes will have more memory allocated?
In java, what is the difference between method overloading and method overriding?
What is unicode used for?
How do you achieve polymorphism in java?
Why can't we override private static methods?
What is boolean example?
What are scalar data types?
What is :: operator in java?
In java how do we copy objects?