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 : Java Inheritance कितने प्रकार के होते हैं ?
Inheritance पांच प्रकार के होते है | लेकिन जावा multiple inheritance को सपोर्ट नहीं करती है। इसलिए जावा मे चार प्रकार के Inheritance होते है |- Single Inheritance
- Multilevel Inheritance
- Hierarchical Inheritance
- Hybrid Inheritance
अगर आपको यह पोस्ट 📑 पसंद आई हो तो अपने मित्रों के साथ जरूर शेयर करें। धन्यवाद !
Tags:
Java