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 keyword auto for?
Why runnable interface is used in java?
Which language is java?
What is role of void keyword in declaring functions?
What is a void method java?
How java uses the string and stringbuffer classes?
What is ellipsis in java?
What is null data type?
What is a boolean expression in java?
What is the preferred size of a component in java programming?
What is the difference between numeric and integer?
Is ruby built on java?
I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?
Explain tree set and its features?
What is anti pattern in java?