aspose file tools*
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Method Overloading" Watch "Method Overloading" New topic
Author

Method Overloading

Ramakrishna Gummadi
Greenhorn

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

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



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

Joined: Oct 14, 2005
Posts: 18570
    
    8

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
Greenhorn

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

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Method Overloading