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 / 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


Please Help Members By Posting Answers For Below Questions

Explain the difference between serializable and externalizable in java?

1033


What data type is true or false?

1026


Explain JMS in detail.

1004


Can we override data members in java?

1126


How do you use substring in java?

1114


What is the disadvantage of synchronization?

992


What is a constructor, constructor overloading in java?

984


Give few examples of final classes defined in Java API?

1173


Give example to differentiate between call by value and call by reference.

1037


What is threaded programming and when is it used? : Java thread

1052


What is static in java?

1069


What is variable in java?

967


What are actual parameters?

1014


What are the different ways of creating thread?

994


Why is java called java?

1031