Simple Explanation of Inheritance | Java Programming Language | #shortsvideo #shortsfeed #coding



Simple Explanation of Inheritance | Java Programming Language | #shortsvideo #shortsfeed #coding

Simple Explanation of Inheritance | Java Programming Language | #shortsvideo #shortsfeed #coding

Inheritance is a pillar in OOP or object oriented programming. It let’s you to share common properties (variables) and behaviour (methods) among classes. To use inheritance in Java, extends keyword is used, where the class which extends another class is called as Derived or Child class while the class that is being extended is called as Base class or Parent class.
The fields and methods of the parent class can be accessed by the child class (dependent on access specifiers used in the parent class).

Java supports :-
1. Single level inheritance
2. Multi-level inheritance
3. Hierarchical inheritance
4. Hybrid inheritance

Note:- Java doesn’t support multiple inheritance as it may lead to Diamond problem.
Read about Diamond Problem – https://en.wikipedia.org/wiki/Multiple_inheritance

#programming #coding #dsa #interview #youtube #java #objectorientedprogramming #oop #inheritance

What is inheritance in java
OOP in java
Object Oriented Programming
What is oop
Pillars of oop