Java Inheritance In Hindi :
inheritance एक ऐसा mechanism है। जिसमे एक class की properties और methods को किसी दुसरे class में उपयोग किया जा सकता है | अर्थात child class अपने parent class के properties और methods को inherit करती है।
parent class को base class , super class और child class को sub class , derived class भी कहा जाता है।inheritance IS-A relationship को represent करता है जिसे parent-child relationship भी कहा जाता है।
जावा में इनहेरिटेंस का उपयोग Method Overriding और Code Reusability के लिए किया जाता है।
Syntax for Inheritance :
class Subclass-name extends Superclass-name
{
//methods and fields
}
Types of Inheritance in Java :
Inheritance पांच प्रकार के होते है | लेकिन जावा multiple inheritance को सपोर्ट नहीं करती है। इसलिए जावा मे चार प्रकार के Inheritance होते है |
- Single Inheritance
- Multilevel Inheritance
- Hierarchical Inheritance
- Hybrid Inheritance
Single Inheritance in Hindi :
एक class दवारा दूसरी class को inherit करना Single inheritance कहलाता है। Single inheritance में एक super और एक sub class होती है।

Syntax for Single Inheritance :
class Superclass-name{
// statement
}
class Subclass-name extends Superclass-name
{
//methods and fields
}
Multilevel Inheritance in Hindi :
जब एक से अधिक class एक level में एक दूसरे को inherit करते है तो उस इनहेरिटेंस को multilevel inheritance कहते है।

उदाहरण के लिए : इस इनहेरिटेंस मे A class को B class दवारा inherit किया जाता है। जिसमे A super class और B sub class होती है। अब C class दवारा B class को inherit किया जाता है। जिसमे C sub class और B Super class होती है।
Syntax for Single Inheritance :
class A
{
// Statement
}
class B extends A
{
//methods and fields
}
class C extends B
{
//methods and fields
}
Hierarchical Inheritance :
जब एक या एक से अधिक sub class / child class द्वारा किसी एक super class / parent क्लास को inherit किया जाता है तो उस इनहेरिटेंस को hierarchical inheritance कहते है।

Syntax for Single Inheritance :
class A{
}
class B extends A
{
//methods and fields
}
class C extends A
{
//methods and fields
}
class D extends A
{
//methods and fields
}
Hybrid Inheritance :
यह इनहेरिटेंस एक से अधिक इनहेरिटेंस का combination होता है।