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

What is the purpose of javac exe?

562


When do we use hashset over treeset?

538


How many classes can any class inherit java?

510


What does it mean to flush a file?

572


How do you sort words in java?

538






How can we make a class singleton?

580


Can we extend singleton class?

533


What is use of super keyword?

569


Explain about oops concepts.

637


Explain jdk, jre and jvm?

569


when should you use stringbuilder class in a program?

524


How can we make string upper case or lower case?

602


Who is the owner of java?

543


What is OOP Language?

631


Can you call a method in a method?

534