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 portable component?

2018


What is the map interface?

1127


What does module-relative mean?

1167


Name three component subclasses that support painting?

1083


wahts is mean by dynavalidatorform in struts/

2080


what are getters and setters in Java with examples?

1782


what are the advantages of JTA over JTS?

2214


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

1120


What is local interface. How values will be passed?

1027


what is an isolation level?

2762


Describe responsibilities of Activator?

2277


what are the activation groupworks?

2203


What is the relation between the infobus and rmi?

1008


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

1077


What is the difference between system.out ,system.err and system.in?

1107