What is the difference between inheritance and extends?

I have not mistaken extends for polymorphism or encapsulation or anything else.. my question is correct!!!

Showing Answers 1 - 15 of 15 Answers

lishaeva

  • Jan 13th, 2012
 

If you have a parent class and a child class, the child will have all the characters of the parent ie, it inherits the functions. To do this while writing a code we use" child extends parent".

Solution is so simple..., Inheritance is the property and extends is the key word for the same.

Note : you cannot extend to more than one class.

  Was this answer useful?  Yes

Mohit

  • Jan 23rd, 2012
 

Inheritance is the process by which we can define the attributes and methods of super class into sub class.
Extend is the keyword to implement inheritance.

Code
  1. public class super{

  2. int value;

  3. public void superclassmethod(){

  4. system.out.println{"Super Class"};

  5. }

  6. }

  7.  

  8. public class sub extends super

  9. {

  10. }

ANKIT SHARMA

  • Feb 14th, 2016
 

In Inheritance the object aquires all the properties & behaviour of parent object

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions