INHERITANCE

Ibrahimjhullan
Nov 6 · 2 min read
We will discuss inheritance
lets take a real world example of parent child relationship
lets take a real world example of parent child relationship
lets take a real world example of parent child relationship

Suppose a father owns a house and he has a son .So the son is indirectly

owner of the house and can access all facilities of the house .

Inheritance in Java:

As we know that java is Object Oriented Programming Language and work on Object instead of functionalities similar with real world example java support Inheritance .In java where Parent class/superclass inherit its properties to child/sub class.

Types of Inheritance

1.Single Inheritance:-

Single inheritance enables a derived class to inherit properties and behavior from a single parent class.

2.Multiple Inheritance:-

Multiple Inheritance is a feature of object oriented concept, where a class can inherit properties of more than one parent class.

Diagram of inheritance

Note:we can only achieve multiple inheritance by interfaces in java .

Syntax of inheritance

hope this blog will help you to understand concept of inheritance in java

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade