2

Possible Duplicate:
Is polymorphism possible without inheritance

I know It can be done through method overriding (Inheritance)and Interfaces implementation. But is there any other way possible? To be precise can overloading in java be considered as a type of polymorphism?

Community
  • 1
  • 1
Jatin Sehgal
  • 956
  • 2
  • 17
  • 37

2 Answers2

5

Overloading is just like the analogy of two John's having different hobbies. They just have the same name, not the same ID. So you cannot think overloading as a type of polymorphism.

Juvanis
  • 25,802
  • 5
  • 69
  • 87
0

Overloading is different. Polymorphism is applied to methods with the same signature, not just the name. Overloading creates methods with different signatures, so they are not subject to polymorphism. (Unless, of course, you override an overloaded method in a subclass.)

Wormbo
  • 4,978
  • 2
  • 21
  • 41