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

Define the remote object implementation?

2568


What is ripple effect?

1125


Explain the difference between object state and behavior?

1115


which book is better for jdbc ,servlets and jsp

2138


Explain about thread synchronization inside a monitor?

2605


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

1123


What is permgen or permanent generation?

1078


Java is fully object oriented languages or not?

1073


Do I have to use jsps with my application?

1067


What is a session? Can you share a session object between different theads?

1036


Name three subclasses of the component class?

1159


Explain the different types of memory used by jvm?

1195


Do we need to override service() method

1786


What is the diffrence between a local-tx-datasource and a xa-datasource? Can you use transactions in both?

1086


What is a class loader?

2075