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


Please Help Members By Posting Answers For Below Questions

Define array. Tell me about 2-D array.

831


Which method cannot be overridden in java?

810


What kind of variables can a class consist?

812


What is array length in java?

746


Give us the name of the list layoutmanagers in java?

721


What is length in java?

781


What is a bufferedreader?

755


How transient variable is different from volatile variable?

785


Why java doesn’t support multiple inheritances?

796


Can we declare a static variable inside a method?

762


What are the types of inner classes (non-static nested class) used in java?

824


How does enum work in java?

794


Can we override singleton class?

754


What is contract between hashcode and equal method?

812


Tell me the latest versions in java related areas?

854