This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes polymorphism,overloading and overiding seems to be the same thing for me 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 "polymorphism,overloading and overiding seems to be the same thing for me" Watch "polymorphism,overloading and overiding seems to be the same thing for me" New topic
Author

polymorphism,overloading and overiding seems to be the same thing for me

Vishal Hegde
Ranch Hand

Joined: Aug 01, 2009
Posts: 1055

hi guys i just read polymorphism,overloading and overridding i felt that their functionalities are almost same ..if there is any difference between these things plase let me know



http://www.lifesbizzare.blogspot.com || OCJP:81%
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3816

Vishal Hegde wrote:i just read polymorphism,overloading and overridding i felt that their functionalities are almost same ..


Overloading & overriding are two different things. Overloaded methods are resolved at compile time whereas overriden methods are resolved at the run time depending on the actual object being referenced. When you override a method you can have the advantage of polymorphic behavior.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Radi Hadzhiyski
Ranch Hand

Joined: Jun 30, 2009
Posts: 47
polymorphism is just a term for that you can have a lot of forms for something:

Example:

if you have the classes: SomethingMobil, Car, Ferrari, Renault, Toyota, Truck, SomeTruckMark, AnotherTruckMark and so on, you want to say probably, that a truck and a car are kinds of SomethingMobil, also Toyota is a kind of SomethingMobil, but Toyota is also a kind of Car and so on. So you have a lot of forms of SomethingMobil and that thing describes the term polymorphism.

override is way to describe this behavior:

You make:



overloading is something else. It is just the way you can write the same methodname, but have a differend kind of parameters:


SCJP 1.6 (91%), SCJD
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Polymorphism is Overriding not an Overloading. Overriding is expected behavior . but Overloading is an abnormal to an Object
 
wood burning stoves
 
subject: polymorphism,overloading and overiding seems to be the same thing for me
 
Similar Threads
Polymorphism
Method Overloading and overriding
Polymorphism
Java Keywords
about polymorphism