File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Overriding of 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 "Overriding of Static Method" Watch "Overriding of Static Method" New topic
Author

Overriding of Static Method

Faraz Alig
Greenhorn

Joined: Mar 14, 2010
Posts: 24
Is it possible to override the static method in subclass? If not then please explain why?


~ Faraz
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1665
    
  11

Have you tried? What happens?


When you do things right, people won't be sure you've done anything at all.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18825
    
  40


To be more specific, create a subclass object, cast it to its superclass type, and try to call the static method... which one gets call? the original super class one? or the subclass version?

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Schumi Mic
Greenhorn

Joined: Apr 17, 2010
Posts: 4
@Faraz: You can find this in-detail @ Overriding Vs Hidding


SCJP 1.5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Overriding of Static Method