File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes static methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "static methods" Watch "static methods" New topic

static methods

sonali rao
Ranch Hand

Joined: Nov 03, 2003
Posts: 64
Can static methods be orver ridden?
Sindhur Sat

Joined: Feb 23, 2004
Posts: 23
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Nope, but they can be hidden. Static methods are not polymorphic. Consider the following:

In this scenario, instances of C can accesses any of the static methods by qualifying the call with the class:

But now C can no longer access the instance methods of A since a super call only applies to B. In the above example, if the class qualifier is removed, then the hidden static method defined in the subclass will be called or the most immediate super class that hides the static method.

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
I agree. Here's the link:
subject: static methods
It's not a secret anymore!