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 / let the code speaks....

* 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
}
}

Running this code produces the output:
a a a

Is This Answer Correct ?    9 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a modular application? What does module-relative mean?

1035


difference between  ejb,struts,hibernate,spring and jsp

2840


Are we allowed to change the transaction isolation property in middle of a transaction?

1019


what is a portable component?

1983


What is the purpose of the finally clause of a try-catch-finally statement?

1019


What is Remote Server?

2182


How would you detect a keypress in a jcombobox?

1119


What is the form of storage space in java?

2233


When is the best time to validate input?

1093


What modifiers may be used with an inner class that is a member of an outer class?

1050


What is the argument type of a programs main() method?

1103


What is clustering? What are the different algorithms used for clustering?

1054


Is jvm a overhead?

1075


What restrictions are placed on the values of each case of a switch statement?

999


If I wanted to use a solarisui for just a jtabbedpane, and the metal ui for everything else, how would I do that?

1035