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 are the important features of Java 10 release?
What is the importance of finally block in exception handling?
Is set sorted in java?
How to find the index of the largest number in an arraylist java?
What are benefits of java?
Explain the private field modifier?
What about instanceof operator in java?
What is the basic concept of java?
Explain the access modifiers for a class, method and variables?
What is method reference?
What is the primary benefit of encapsulation?
Can static method access instance variables ?
What is the generic function?
How garbage collection is done in java?
What does the “static” keyword mean? Can you override private or static method in java?