Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is a "pure virtual" member function?

1041


Write a program to print fibonacci series up to count 10.

851


What is an error in java?

1092


How to sort a collection of custom Objects in Java?

995


How variables are stored in memory?

953


What is java util concurrentmodificationexception?

868


Explain the purpose of garbage collection in Java?

971


What is meant by anonymous class?

974


Write a java program for binary search?

1008


What is the purpose of static methods and static variables?

999


Is the empty set a singleton?

910


How to use arraylist in java netbeans?

975


Give the difference between the println method and sqrt method?

1032


What is difference between == equals () and compareto () method?

981


What happens when main () method is declared as private?

1084