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

Which containers use a border layout as their default layout?

1075


What is a class loader? What are the different class loaders used by jvm?

1054


Write a program to show synchronization?

1088


What is the difference between the session.get() method and the session.load() method?

1039


Why won’t the jvm terminate when I close all the application windows?

1191


What event results from the clicking of a button?

1173


How messaging services are done, before release of JMS?

2074


Can we sent objects using Sockets?

1083


Why is actionform a base class rather than an interface?

1002


how do you Handle Front End Application data against DB with example?

1917


What is the difference between RMI registry and OS Agent?

1074


Explain what is orm?

1066


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

1004


What is the purpose of the notify() method?

1017


Define prototype?

999