File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Difference between polymorphism and inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Difference between polymorphism and inheritance" Watch "Difference between polymorphism and inheritance" New topic

Difference between polymorphism and inheritance

jo sim
Ranch Hand

Joined: Apr 24, 2006
Posts: 37
Hi I know about overriding, overloading, extending classes. I just dont know the difference between polymorphism and Inheritance.
marc weber

Joined: Aug 31, 2004
Posts: 11343

See How my dog learned polymorphism, and let us know if that clears it up.

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 45421
This sort of question comes up frequently; you can get answers by searching. I wrote about it myself about a week ago here.

Polymorphism is one of the features or results of inheritance.
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Campbell Ritchie:

Polymorphism is one of the features or results of inheritance.

That's not true. What is true is that *in Java* polymorphism is coupled to inheritances. But there are languages that provide polymorphism without the need for inheritance; and there are other languages that have inheritance without polymorphism.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
I agree. Here's the link:
subject: Difference between polymorphism and inheritance
It's not a secret anymore!