explain the concept of inheritance with an example?
Answer Posted / kkr
Inheritance is the process of creating the classes from existing classes by using 'extends' key word.
It is like IS-A relationship between the classes.
eg : Parent and child relationship. we cal parent class as super class and child class will be subclass.i.e the subclass will have all the members of super class.
Adv : Reusability of the code.i.e productivity will be increase.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is an anonymous class in java?
What is contract between hashcode and equal method?
What is the difference between class & structure?
How do you sort words in java?
How do you convert boolean to boolean?
Is age a discrete variable?
What is the instance of an object?
What are the uses of synchronized keyword?
What does the “final” keyword mean in front of a variable? A method? A class?
How do you control extraneous variables?
What’s the difference between unit, integration and functional testing?
Why scanner is used in java?
How can you make a class serializable in java?
What is null statement?
I have multiple constructors defined in a class. Is it possible to call a constructor from another constructor’s body?