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 5 features introduced in jdk 1.7?

1029


What is the purpose of static methods and static variables?

1073


What are the different types of constructor?

996


How do you implement tree mirroring in java?

1082


What are the problems faced by java programmers who don't use layout managers?

985


What are the different types of inheritance in java?

991


What are streams in java 8?

1010


What is ctrl m character?

1063


What is the difference between equals() and?

1200


What is the difference between conversation & casting?

1060


Mention the default values of all the elements of an array defined as an instance variable.

989


How does a for loop work?

992


Why are lists ordered in java?

1018


How do you escape json?

999


What is java in layman terms?

1017