0% found this document useful (0 votes)
13 views1 page

Understanding Inheritance in Java

Uploaded by

Yash Kinha
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views1 page

Understanding Inheritance in Java

Uploaded by

Yash Kinha
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Inheritance in Java >

- it is the machanism in which one object acquire the properties(data


members)
and behaviour(functionalities/methods) of another object
- the purpose of inheritance to reusability of code.

child class : the class that extends the feature of another class called as
sub class or derived class
parent class : the class whose properties and functionalities used by another
class
is known as super class or base class

- to inherit 'extends' keyword is used

Syntax :

class A{
void demo(){
//......a
}
}

class B extends A{
A
+
demo(){
//......b
}
}

class C extends B{
}

C obj = new C();


[Link]();

// this feature will be used in interface

Types of inheritence:
1. single
2. multilevel
3. multiple //ambiguity(confusion)
4. hierarchical
5. hybrid

// for image

[Link]

You might also like