*
The moose likes Beginning Java and the fly likes using static method in polymorphism Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "using static method in polymorphism" Watch "using static method in polymorphism" New topic
Author

using static method in polymorphism

Jithesh Kumar
Ranch Hand

Joined: Mar 09, 2010
Posts: 46
can a static method can be involved in polymorphism..i mean both static and dynamic polymorphism?
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

Yes, static methods are involved in polymorphism.but only in static polymorhism (i.e static methods can be overloaded) but they are not involved in runtime polymorphism (i.e. static methods can't be overridden).


Life is easy because we write the source code.....
Jithesh Kumar
Ranch Hand

Joined: Mar 09, 2010
Posts: 46
no i think static method can be overridden... i tried it but regarding overloading i needed the reply
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

we can't override static methods, but we can overload static method.
Lorand Komaromi
Ranch Hand

Joined: Oct 08, 2009
Posts: 276
bon jith wrote:i think static method can be overridden... i tried it


You can't override a static method, but you can hide it. This article explains the differences between overriding and hiding.


OCJP 6 (93%)
Jithesh Kumar
Ranch Hand

Joined: Mar 09, 2010
Posts: 46
can you give me some example of polymorphism in static overloaded methods?...
Muhammad Khojaye
Ranch Hand

Joined: Apr 12, 2009
Posts: 449

bon jith wrote:can you give me some example of polymorphism in static overloaded methods?...

see this FAQ


http://muhammadkhojaye.blogspot.com/
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18753
    
  40

Please be careful with the term "polymorphism". There are lots of definitions out there -- and many are very loose as to include, method overloading, operator overloading, templates / generics, among them.

I would highly recommend that you use the one used by your professor (in your textbooks), or you could wind up failing, because you are using one of those "looser" and not accepted by your professor definitions.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Raj chiru
Ranch Hand

Joined: Aug 12, 2008
Posts: 141
see this Article Static
 
 
subject: using static method in polymorphism