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

In Inheritence concept, i have a static method in super
class and i am inheriting that class to one sub class.in
that case the static method is inherited to sub class or
not????

Answer Posted / dhanunjaya

see below example it is possible to inherite the static methods from the parent class

class Test{

void m1(){

System.out.println("test instance method");
}

static void m2(){

System.out.println("test static method");
}

}

class Demo extends Test{


void m3(){

System.out.println("demo instance method");
}


public static void main(String ar[]){
System.out.println("main method");
Demo d=new Demo();

d.m3();
d.m2();
}
}
o/p:main method
demo instance method
test static method

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between a break statement and a continue statement?

989


Can inner class be public in java?

969


What is meant by data hiding/encapsulation?

1043


When the constructor of a class is invoked?

979


What is the byte range?

979


Which is faster call by value or call by reference?

865


When can an object reference be cast to an interface reference in java programming?

955


What is instance example?

900


What are the practical benefits, if any, of importing a specific class rather than an entire package (e.g. Import java.net.* Versus import java.net.socket)?

1076


Is java 9 released?

943


What is object-oriented programming?

1026


How do I know if java is installed?

1015


Is arraylist ordered?

1004


What is difference between printf and scanf?

1040


Can memory leak in java?

983