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 is a java list?
Explain the importance of finally over return statement?
Explain the difference between collection api and stream api in java8?
what is singleton class in java?
What is null statement?
Explain the difference between protected and default access.
What is the difference between a loader and a compiler?
What is tochararray in java?
What are the differences between string, stringbuffer and stringbuilder?
Explain about static nested classes in java?
What are class types in java?
What is thread count in java?
What is data type example?
Is a method a function?
What is integers and example?