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

What is oop principle in java?

1051


What is definition and declaration?

965


Why is core java important?

991


What is a string what operation can be performed out with the help of a string?

967


What is the main purpose of java?

1014


How do you compare two objects?

877


Why is inheritance used in java?

1059


What is the base class for error and exception?

947


What is the final class?

975


Is arraylist zero based?

1005


What are the skills required for core java?

948


Which non-unicode letter characters may be used as the first character of an identifier?

960


What is the java reflection api? Why it’s so important to have?

924


What does %4d mean in java?

1420


Which method you will use to create a new file to store some log data. Each time a new log entry is necessary, write string to the file in java ?

1099