| Author |
Static Methods
|
Senthil Nathan
Greenhorn
Joined: Jul 23, 2005
Posts: 2
|
|
what happens if i extend a class to subclass and try to override the static method in superclass using following objects 1) subclass obj=new subclass() 2) superclass obj=new superclass() 3) superclass obj=new subclass() what be internally happen which would be inherited anr override and which willl not override.
|
 |
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9033
|
|
Hi, Notmine Jeoffrey Welcome to JavaRanch! Please adjust your display name to meet the JavaRanch Naming Policy. You can change it here. Thanks! Now, on to your question: You can try to override the static method in superclass, but it is impossible.
|
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
|
 |
Mark Henryson
Ranch Hand
Joined: Jul 11, 2005
Posts: 200
|
|
Hi, If you want to override the static method in the super class, it will be called as Overhidding and not Overriding. I given the sample program below. Just go thru it. Note: I am also in learning curve. If anything wrong in this, pls post the reply.
|
 |
 |
|
|
subject: Static Methods
|
|
|