aspose file tools*
The moose likes Beginning Java and the fly likes static methods and overrides Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "static methods and overrides" Watch "static methods and overrides" New topic
Author

static methods and overrides

kambiz shahri
Greenhorn

Joined: Oct 29, 2007
Posts: 3
It is not possible to override an inherited static method...so the Java cert books says. You can only "redefine the method" in a subclass of the superclass that defined the static method.

However when in eclipse i try to "redefine" the inherited static method, it will complain if try to narrow the access modifier.

The certification book is NOT any clearer on the subject.

thanks for the answers in advance.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
[KS]: However when in eclipse i try to "redefine" the inherited static method, it will complain if try to narrow the access modifier.

Yes, that's because the rules for method hiding (what your book calls "redefining") are similar to the rules for overriding. That doesn't mean that static methods can be overridden - it just means that some of the behavior is similar.

I recommend reading Overriding vs. Hiding for more discussion.


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: static methods and overrides