Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Jaxson Brown   on Aug 12 In Java Category.

  
Question Answered By: Geb Chalthoum    on Aug 12

"Polymorphism" means "A method(call?) acts different
depending upon the nature(type) of the parameter which
is passed"

Generally polymorphism helps robust Type checking at
the compilation time & making the programmer's life
little bit easier (atleast we dont want learn
different different method names for each type it
accepts)

If you want more info just go through
"java.lang.String" class's javadoc info. there u can c
a method named "valueOf()" for each & every
type(int,float,double,boolean,char,etc.,)

thnks to Polymorphism so we dont want to remember a
unique name for each & every type toIntValueOf,
toFloatValueOf, toDoubleValueOf,
toBooleanValueOf,toCharValueOf & (may be
toNullValueOf()!!!!!!!!)

try the following ex:-
----------------------
there is class "A" having "print" method with "String"
parameter, and then class "B" extending class "A"
having two more methods with the same name ("print")
but with diff type of parameters.

class "Poly" is extending class B (so class A as well)
calling the same method "print" with 3diff parameters,
each time the appropriate method automatically called
by the JVM & executed,,,

Share: 

 

This Question has 23 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Polymorphism Or get search suggestion and latest updates.

Related Topics:

Tagged: