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

worst case complexities of Quick sort and Merge sort.

1006


How many types of flags are there?

1004


What are the 6 mandatory procedures for iso 9001?

1000


Convert Binary tree to linked list.

1065


Define how destructors are defined in java?

1003


What does serializing data mean?

916


Which of the classes will have more memory allocated?

957


In java, what is the difference between method overloading and method overriding?

1098


What is unicode used for?

1138


How do you achieve polymorphism in java?

983


Why can't we override private static methods?

954


What is boolean example?

944


What are scalar data types?

1039


What is :: operator in java?

958


In java how do we copy objects?

1034