can any one tell me when do u go for inheritance and
polymorphism
Answer Posted / krish
Inheritance:Your are in a situation where you have to the
properties of a whole class repeatedly then you can go for
inheritance.
Note:Final class can't be inherited.
Polymorphism:When you are in a situation where you need to
use a method repeatedly then you can go for polymorphism.
Eg:
consider this method
add(int i,int j) and add(String s1,String s2)
the former will add two integers and later will concatenate
two strings but both using the same method name.
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Is multiple inheritance supported by java?
What are the two types of java programming?
What are computer functions?
How many characters is 2 bytes?
Can we declare an interface as final?
What is the main purpose of java?
When super keyword is used?
Is hashmap thread safe?
What do you understand by java virtual machine?
What is the SimpleTimeZone class?
What is initial size of arraylist in java?
How can a gui component handle its own events?
What is callablestatement? How you can call stored procedure to pass in parameter?
What do you know about java?
what is mena by object block any what is the use of that