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


Please Help Members By Posting Answers For Below Questions

Explain the difference between call by refrence and call by value?

803


Is map sorted in java?

836


What is the list interface?

859


How do you generate random numbers in java?

770


What does it mean that strings are immutable?

892


What is super keyword explain with example?

785


Can you override a final method?

804


Explain with example the concept of constant variable in java.

896


How do you empty a list in java?

777


What are the steps that are followed when two computers connect through tcp?

774


What is the difference between sop and work instruction?

710


Why parsing is done?

757


What is the Scope of Static Variable?

976


When parseint method can be used?

740


Can we have return statement in finally clause? What will happen?

761