*
The moose likes Beginning Java and the fly likes Please suggest how to inherit static method from class and override one method among that? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Please suggest how to inherit static method from class and override one method among that?" Watch "Please suggest how to inherit static method from class and override one method among that?" New topic
Author

Please suggest how to inherit static method from class and override one method among that?

jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
I have a class(A) with some static methods, I want to inherit all the method of class A and override one Method. Overriding Static method is not possible,

Please suggest how to inherit static method from class and override one method among that?
Antany Vasanth
Ranch Hand

Joined: Jan 28, 2009
Posts: 43
Hello Jacob,

Please refer the below thread. It will give some idea about static methods and its usage in subclasses.

http://www.coderanch.com/t/456150/Java-General/java/All-about-static-methods

Regards,
Antany
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3816

jacob deiter wrote:I have a class(A) with some static methods, I want to inherit all the method of class A and override one Method. Overriding Static method is not possible,


Yes, You can't override static to be non static in the subclass (OverridingVsHiding). Of course you can hide the methods by redefining them in the sub class (as static methods). If you expect the runtime polymorphism with those method, well you may have to look other options depending on your requirement.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37953
    
  22
People have already told you it is not possible to override static members. You have some very bad design if you are even thinking of doing that.
 
 
subject: Please suggest how to inherit static method from class and override one method among that?
 
Similar Threads
Help in statics
override static class?
Object
private method override
The game of statics