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
Explain the difference between call by refrence and call by value?
Is map sorted in java?
What is the list interface?
How do you generate random numbers in java?
What does it mean that strings are immutable?
What is super keyword explain with example?
Can you override a final method?
Explain with example the concept of constant variable in java.
How do you empty a list in java?
What are the steps that are followed when two computers connect through tcp?
What is the difference between sop and work instruction?
Why parsing is done?
What is the Scope of Static Variable?
When parseint method can be used?
Can we have return statement in finally clause? What will happen?