This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes static method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "static method" Watch "static method" New topic

static method

Praveen Ravinuthala

Joined: Aug 28, 2012
Posts: 7
when we override static method in subclass,

if we use polymorphism to call to subclass method through super class reference ,the super class static method will be executed.But when we create object separately for subclass and subclass static method called by using object,then subclass will be executed.why?
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 43957
You can’t override static methods. Start with this FAQ.
I agree. Here's the link:
subject: static method
It's not a secret anymore!