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 / debapriya maity
First super keyword cannot be used from a stati
ccontext,this is the first thing to be remembered.The
correct procedure is
class A{
m2(){
super();
}
}
class B extends A{
m2(){
super();
}
}
class c extends B{
m2(){
super();
}
}
class my_class extends c{
m2(){
super();
}
pulic static void main(){
my_class a = new my_class();
a.m2():
}
}
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is internal variable?
what is enumset?
List out five keywords related to exception handling ?
Can a class have multiple subclasses?
What is java abstraction with example?
What is an infinite loop? How infinite loop is declared?
How many types of classes are there in java?
What is the SimpleTimeZone class?
What is the difference between static binding and dynamic binding?
What is a parameter in matrices?
Explain about anonymous inner classes in java?
How do you declare a variable?
Can you give few examples of final classes defined in java api?
What is included in core java?
What is difference between hashset and hashmap?