permaculture playing cards
The moose likes Beginning Java and the fly likes Method Overloading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Method Overloading" Watch "Method Overloading" New topic

Method Overloading

Ramakrishna Gummadi

Joined: Jun 29, 2011
Posts: 16
Is method overloading comes under polymorphism ?
vineet dhar

Joined: Aug 17, 2011
Posts: 23
Ramakrishna Gummadi wrote:Is method overloading comes under polymorphism ?

Polymorphism is mainly related with method overriding............
Paul Clapham

Joined: Oct 14, 2005
Posts: 19760

Of course that depends on your definition of those two terms. I would recommend reading the Wikipedia article about polymorphism if you are really interested in this topic: Polymorphism (computer science).
Ankur Kapoor

Joined: Sep 13, 2006
Posts: 11

vineet dhar wrote:

Polymorphism is mainly related with method overriding............

Overloading is a compile time Polymorphism .. while Overriding is a runtime Polymorphism.

Just analyze, when you try to overload a method, if the signature of it does'nt suits the specs of an overload it will give you a Compile time error..... since the JVM compiler checks it before .... now when you override a method from a parent to a child class, then depending on the Object (Parent/Child) which you have instantiated irrespective of its reference, the overrided method gets called from that object ... this decision is made at runtime

Ankur Kapoor

I agree. Here's the link:
subject: Method Overloading
It's not a secret anymore!