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

This will work......

class A{
public void m2(){
System.out.println("called...");
}
}

class B extends A{
public void m2(){
super.m2();

}
}

class c extends B{
public void m2(){
super.m2();

}
}

class my_class extends c{
public void m2(){
super.m2();

}

public static void main(String[] args){

my_class a = new my_class();
a.m2();

}
}

Is This Answer Correct ?    10 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a jagged array in java?

1089


What are the main differences between notify and notifyAll in Java?

1076


Can a final variable be null?

1000


Can we restart a dead thread in java?

973


What is the use of predicate in java 8?

939


Which is faster set or list in java?

1015


Can we catch more than one exception in single catch block?

1034


What is a parent class in java?

1000


What does exclamation mean in java?

1075


What is method overloading and method overriding?

1042


How do you read and print a string in java?

940


Which methods are used during serialization and deserialization process?

980


is there a separate stack for each thread in java? : Java thread

960


These static constructors are correct ? class A { statc intA() { } static A(int x,int y) { } static A(int x) { } }

1071


What are the escape sequences in java?

1011