File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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: 46353
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!