Share on Google+Share on Google+

shiva krishna
1 Answer(s)      9 years ago
Posted in : Java Beginners
View Answers

May 26, 2008 at 4:55 PM


Polymorphism means the ability to take more than one form. Polymorphism means 'any forms.' In OOP, it refers to the capability of objects to react differently for the same method.

In OOP methodoverloading refers to the capability of objects to react differently for the same method. Polymorphism can be implemented in Java language in form of multiple methods having the same method name. Java code uses a late-binding for supporting polymorphism, the method which is invoked is decided at runtime.

1. Method Overloading

2. Method Overriding

1. Method Overloading :-
Overloaded methods are methods have the same name, but different argument lists.
Overloaded methods have the same names but different argument lists. The arguments may differ in type or number, or both. However, the return types of overloaded methods can be the same or different.

Here is simple example of Overloading

class methodOverloading{

int add( int a,int b){
float sub(float a,float b){
double add( int a, double b,double c){
int mul(int i, int j){

public class mainClass extends methodOverloading{

public static void main(String arr[]){
System.out.println("This progrsm display the add massage.");
mainClass temp = new mainClass();
System.out.println("Addition value is: " +temp.add(10,20));
System.out.println("Subtraction value is: "+temp.sub(1.5f,2.3f));
System.out.println("Addion of double value is: "+temp.add(10,20.4,25.6));
System.out.println("Multiple value is: "+ temp.mul(10,10));

Read for more information.



Related Tutorials/Questions & Answers:
polymorphism  can we achieve without overriding polymorphism
dynamic polymorphism
dynamic polymorphism  Develop with suitable hierarchy, classes for Point, Shape, Rectangle, Square, Circle, Ellipse, Triangle, Polygon, etc. Design a simple test application to demonstrate dynamic polymorphism
Polymorphism in actionscript
Polymorphism in actionscript  Hi....... Please implement How polymorphism works on actionscript? Thanks  Ans: class Worker extends Employee { override public function receivePayment():Number { return 0
dynamic polymorphism
dynamic polymorphism  give an example for dynamic polymorphism?   Dynamic polymorphism is where a class overrides a superclass method... of Dynamic Polymorphism that will develop suitable hierarchy, classes for Point, Shape
Does hibernate support polymorphism?
Does hibernate support polymorphism?  Hi, Does hibernate support polymorphism? thanks
Polymorphism in Hibenate - Hibernate
Polymorphism in Hibenate  Hi, How polymorphism inheritance and association achieved in hibernate. Thank u in advance
Java run time polymorphism
Java run time polymorphism  What is run-time polymorphism or dynamic method dispatch
Run time polymorphism
Run time polymorphism  What is run time polymorphism or dynamic method dispatch
Polymorphism - Java Beginners
Polymorphism  type of polymorphism  In Java polymorphism... Or we can also say that a polymorphism is possible in both state Static and Dynamic. Coz polymorphism means in many forms. So do not get confused of it just
Dynamic Polymorphism - Java Beginners
Dynamic Polymorphism  Develop with suitable hierarchy, classes for Point, Shape, Rectangle, Square, Circle, Ellipse, Triangle, Polygon, etc. Design a simple test application to demonstrate dynamic polymorphism.? Thanks
Dynamic polymorphism - Java Beginners
Dynamic polymorphism  Develop with suitable hierarchy, classes for point, shape, rectangele, square, circle,ellipse, triangle, polygon, etc. Design a simple test application to demonstrate dynamic polymorphism.. Thanks
Polymorphism in Java 7
This tutorial describe concept of Polymorphism. It is one of OOPs concept
polymorphism - Java Beginners
polymorphism  what is polymorphism? what is the advantage of function overloading? explain the concept of operator overloading?  Hi Friend, Please visit the following links: http://www.roseindia.net/help/java/m
Polymorphism - Java Beginners
Polymorphism  what is dynamic polymorphism? with example  Hi friend, Dynamic polymorphism is run time polymorphism. Thanks  The term static polymorphism is associated with overloaded methods because
Polymorphism - Java Beginners
Q: Isn't it possible to detect the method's associatation, in case of method... is run (run-time polymorphism) ? Isn't java compiler having such an ability... Polymorphism means the ability to take more than one form. Polymorphism
runtime polymorphism - Development process
runtime polymorphism  how run time polymorphism is achieved  Hi Friend, The run-time polymorphism is basically the Method Overriding.Here super class reference is referring to subclass object and compiler does
Polymorphism : Method Overriding
In this tutorial you will learn another concept of polymorphism that is method overriding
PHP Polymorphism Function
PHP Polymorphism Function: The PHP Polymorphism Method is one of the feature of OOP language. Generally we get polymorphism in two ways: Compile time Run time Compile time polymorphism PHP is like function overloading, operator
Polymorphism : Method Overloading
In this tutorial you will learn one of polymorphism concept that is method overloading with example in Java 7
What is Polymorphism in Java?
Polymorphism in Java means a subclass, though having its own unique behavior... IS-A relationship is polymorphic. In Polymorphism, common interface is used while writing code. Single polymorphism is achieved by method overriding while multiple
( Inheritance,need help in Polymorphism, Overriding) - Java Beginners
( Inheritance,need help in Polymorphism, Overriding)  can any one please help me create this application,thank you Advanced Concepts with Classes( Inheritance, Polymorphism, Overriding) Employees in a company are divided
Java question to implement polymorphism - Java Beginners
Java question to implement polymorphism  I have a question that i need to answer:- Using the principle of polymorphism provide implementation for the calculateFees() method for each Online Fax Subscription type
; OOPs revolve around the four concepts: 1. Encapsulation 2. Polymorphism..., programmatically. Here we will discuss Polymorphism briefly: -- Polymorphism... behavior to method calls of the same name. -- Polymorphism does not allow
( Inheritance, Polymorphism, Overriding)i need help - Java Beginners
( Inheritance, Polymorphism, Overriding)i need help  Advanced Concepts with Classes( Inheritance, Polymorphism, Overriding) i need help to create this application,than you Employees in a company are divided into the classes
Method Overloading in java
; Polymorphism is the capability of an object to respond uniformly... implementations. In java the concept of Polymorphism is achieved in two ways... the compile time polymorphism. -- Overloaded methods are always the part
Analysis tool - SourceGlider for Eclipse
Analysis tool - SourceGlider for Eclipse         For code understanding Modern Java programs make heavy use of methods overloading, polymorphism and subtle design
Encapsulation in Java
Encapsulation along with Inheritance, Polymorphism, and Abstraction are the four concepts of Object Oriented Programming (OOPs). Encapsulation in Java is the technique of binding or wrapping the data and the codes in a class private
Java Spring Hibernate Struts Training java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient How do I resolve this Java Class not found exception? httpclient java.lang.NoClassDefFoundError Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java Java Example Codes and Tutorials in 2017 How do I read a large file quickly in Java? Is learning Java worthwhile?


Advertisement null