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 Composition?
What is the difference between abstract class and interface1? What is an interface?
What is bytecode in java ?
how can you catch multiple exceptions in java?
What are reference variables in java?
What do you mean by exception handling in Java?
How many decimal digits is 64 bit?
How many characters is 2 bytes?
What are advantages of exception handling in java?
What is a static class in java?
What is this keyword used for?
Why hashcode is used in java?
What is pass by value?
What is thread start?
Is it possible to instantiate the abstract class?