Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Method Overloading

 
Ramakrishna Gummadi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is method overloading comes under polymorphism ?
 
vineet dhar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ramakrishna Gummadi wrote:Is method overloading comes under polymorphism ?



Polymorphism is mainly related with method overriding............
 
Paul Clapham
Sheriff
Posts: 21314
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
Java Postgres Database Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic