can any one tell me when do u go for inheritance and
polymorphism
Answer Posted / ganesh
Inheritance :
If you want to reuse the existing class
characteristics(methods,variables ..) then you will use
inheritance ..
Polymorphism :
If you want a method to respond based on our requirement
then we will use polymorphism ..for example like swapping
two variables is same for all types but if write program
means for different types(int,double,char..) u need to write
different methods but under a common method name..
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Why hashmap is used in java?
What is externalizable?
What is the difference between a field variable and a local variable?
What is numeric function?
Is hashset ordered?
How to perform linear search in java?
Explain how to force the garbage collection in java.
What are the types of web technologies?
Explain the difference between transient and volatile in java?
What are the high-level thread states in java programming?
What does file separator do in java?
What does int [] mean in java?
What is singleton service?
Difference between overriding and overloading in java?
Is it necessary for the port addresses to be unique? Explain with reason.