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
What does string intern() method do?
What is an example of a conditional statement?
What is the transient keyword?
What is the use of System class?
Explain the purpose of garbage collection in Java?
When will we use them?
Can we serialize static variables in java?
How many bits is a float?
What access modifiers can be used for class ?
What is subsequence of a string?
Explain implementation and how is it different from conversion?
How do you add spaces in java?
Is class is a data type?
What are sets in java?
How do you sort a string in alphabetical order in java?