Hi all,

I am having confusion on polymorphism

1)Is Method Overloading considered as polymorphism?
2)Is there two types of polymorphism(run time and compile time ) available?

thanks in advance

Recommended Answers

All 6 Replies

1. Simple: yes!
2: Not that I know of. The methods you make are just as they are on runtime, only compiled.

Thanks for your replay hiddepolen,
but when i was searching i got information like

Polymorphism is not the same as method overloading or method overriding.1 Polymorphism is only concerned with the application of specific implementations to an interface or a more generic base class.


Polymorphism is the capability of an action or method to do different things based on the object that it is acting upon. This is the third basic principle of object oriented programming. Overloading, overriding and dynamic method binding are three types of polymorphism.

From: http://home.cogeco.ca/~ve3ll/jatutor5.htm
Sounds to me like it is. Overloading is one of the three forms...

OK, here is some info from oracle website for overload. http://download.oracle.com/javase/tutorial/java/javaOO/methods.html

Overloading Methods

The Java programming language supports overloading methods, and Java can distinguish between methods with different method signatures. This means that methods within a class can have the same name if they have different parameter lists (there are some qualifications to this that will be discussed in the lesson titled "Interfaces and Inheritance").

And here for polymorphism. http://download.oracle.com/javase/tutorial/java/IandI/polymorphism.html

The Java virtual machine (JVM) calls the appropriate method for the object that is referred to in each variable. It does not call the method that is defined by the variable's type. This behavior is referred to as virtual method invocation and demonstrates an aspect of the important polymorphism features in the Java language.

1)Is Method Overloading considered as polymorphism?
2)Is there two types of polymorphism(run time and compile time ) available?

1. According to Oracle's web site - yes.
2. Given that Q1 answer is yes, then yes. Overridden methods are resolved at run time based on the target's run-time type. Overloaded methods are resolved at compile time based on the number and types of the arguments. Overridden overloaded methods are presumably resolved by a combination of the two.

thanks for all replies

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.