Can variables in Java exhibit polymorphism?

20 pts.
Tags:
Java
Can variables in JAVA exhibit polymorphism? If yes,the how?
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

The word “Polymorphism” means “many forms”. It comes from
the Greek word “Poly” which means “many” and “morphous” means “forms”. The
ability to exist in different form is called Polymorphism.

 In java ,
a variable, an object or a method can exist in
different forms, thus performing various tasks depending on the context. If the
same method performs different tasks, then that method is said to exhibit
polymorphism.

There are two types of Polymorphism:

1.    Static polymorphism —-

 The polymorphism exhibited at compile
time
 is called static polymorphism.

2.    Dynamic polymorphism-

 The polymorphism
exhibited at run time is called dynamic polymorphism.

·        
This means when a method is called, the method
call is bound to the method body at the time of running the program,
dynamically

·        
In this case, java compiler does not know
which method is called at the time of compilation, only JVM knows at
runtime which method is to be executed.

·        
Hence this is also called runtime
polymorphism or dynamic binding.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: