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

can a static method be overridden

Answer Posted / nisha

/* STATIC METHODS CANT BE OVERRRIDDEN....*/

class Animal {
static void doStuff() {
System.out.print("a ");
}
}

class Dog extends Animal {
static void dostuff() { // it's a redefinition,
// not an override
System.out.print("d ");
}

public static void main(String [] args) {
// Animal [] a = {new Animal(), new Dog(), new Animal()};
// for(int x = 0; x < a.length; x++)
// a[x].doStuff(); // invoke the static method

dostuff();
Animal a=new Dog();
a.doStuff();
}
}

Is This Answer Correct ?    2 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is Stream Tokenizer?

2178


wahts is mean by dynavalidatorform in struts/

2000


Define the remote object implementation?

2417


What class is used to create Server side object ?

2181


Describe, in general, how java's garbage collector works?

988


Why does the tag url-encode javascript and mailto links?

958


What is the difference between long.class and long.type?

1006


Is infobus easy to use?

991


What is ripple effect?

1028


Which container method is used to cause a container to be laid out and redisplayed?

1096


why static class in java

1724


Can I run seam outside of jboss as?

1036


What is the difference between RMI registry and OS Agent?

1076


Describe responsibilities of Activator?

2174


How to pass parameters in RMI?

2224