Polymorphism
By: aathishankaran Printer Friendly Format
Polymorphism
Polymorphism
is a feature that allows one interface to be used for a general class of action.
The specific action is determined by the exact nature of the situation. Consider
a stack. You might have a program that requires three type of stack.
One
stack is used for integer values, one for floating-point values and another for
characters. However, because of polymorphism, in Java you can specify a general
set of stack routines that all share the same names.
More
generally, the concept of polymorphism is often expressed by the phrase
"one interface, multiple methods." This means that it is possible to
design a generic interface to a group of related activities. This helps reducing
complexity allowing the same interface to be used to specify a general class of
action.
It
is compiler's job to select the specific action as it applies to each situation.
You, the programmer, do not need to make this selection manually.
Comment on this tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Subscribe to Tutorials
Related Tutorials
Program using concept of byte long short and int in java
Update contents of a file within a jar file
Tomcat and httpd configured in port 8080 and 80
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program in Java
Calculate gross salary in Java
Calculate average sale of the week in Java
Vector in Java - Sample Program
MultiLevel Inheritance sample in Java