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 / priynajan
No it is not leagal the correct procedure is:
class A{
void m2(){System.out.println("in class A"); }
}
class B extends A{
void m2(){
System.out.println("in class B");
}
}
class c extends B{
void m2(){
System.out.println("in class c");
}
}
class Check extends c{
void m2(){System.out.println("in check()"); }
public static void main(String[] args){
A obj =new A();
obj.m2();
}
}
..
Works correctly :-)
| Is This Answer Correct ? | 1 Yes | 8 No |
Post New Answer View All Answers
Explain 5 features introduced in jdk 1.7?
What is the purpose of static methods and static variables?
What are the different types of constructor?
How do you implement tree mirroring in java?
What are the problems faced by java programmers who don't use layout managers?
What are the different types of inheritance in java?
What are streams in java 8?
What is ctrl m character?
What is the difference between equals() and?
What is the difference between conversation & casting?
Mention the default values of all the elements of an array defined as an instance variable.
How does a for loop work?
Why are lists ordered in java?
How do you escape json?
What is java in layman terms?