ErrorException Message: Argument 2 passed to WP_Translation_Controller::load_file() must be of the type string, null given, called in /home/equicklearning/public_html/wp-includes/l10n.php on line 838
https://www.equicklearning.com/wp-content/plugins/dmca-badge/libraries/sidecar/classes/ Types of Inheritance in Java in Hindi? | How Many Types of Inheritance in Java? - Equick Learning
Home Programming Languages JAVA Types of Inheritance in Java in Hindi? | How Many Types of Inheritance in Java?

Types of Inheritance in Java in Hindi? | How Many Types of Inheritance in Java?

0

हैलो दोस्तों ?नमस्कार कैसे है आप सभी, मैं आशा करता हूँ की आप सभी अच्छे ? ही होंगे | तो दोस्तों मैं अ‍नुज द्विवेदी आज आप सबके के लिये  बहुत ही Important और Inheritance से Related Types of Inheritance in Java के बारे में पोस्ट लेकर आया हूँ |  

Types of Inheritance in Java in Hindi? | How Many Types of Inheritance in Java?

OOPs Programming language में Types of Inheritance 5 प्रकार के होते है जो निम्नलिखित प्रकार से है –

  1. Simple Inheritance
  2. Multilevel Inheritance
  3. Hierarchical Inheritance
  4. Multiple Inheritance
  5. Hybrid Inheritance

लेकिन Java Programming  Language में Types of Inheritance सिर्फ 3 प्रकार के support करते है जो निम्न प्रकार से है

  1. Simple Inheritance
  2. Multilevel Inheritance
  3. Hierarchical Inheritance

1. Simple Inheritance:-

इस प्रकार के Inheritance में एक Super class तथा दुसरी Sub class होती है । Super class को Sub class में हम extends keyword का प्रयोग करके inherit करते है । इसका Syntax इस प्रकार है ।

class Superclass{
// code here
}
class Subclass extends Superclass{
// code here
}

2. Multilevel Inheritance :-

जब एक से अधिक class एक level में एक दुसरे को extends करती है तो इसे multilevel Inheritance कहा जाता है इसमें एक sub class किसी दूसरी super class को inherit करता है तथा उस sub class को एक अलग class Inherit करता है जिसके लिये वह दूसरी class super class बन जाता है |    

class A{
// code here
}
class B extends A{
// code here
}
class C extends B{
// code here
}

3. Hierarchical Inheritance :-

जब एक class को एक से अधिक class द्वारा inherit किया जाता है तो उस Inheritance को Hierarchical inheritance कहते है । इसमे एक class की property को एक से अधिक class द्वारा use किया जाता है । इस प्रकार के Inheritance में एक Super class और एक से अधिक sub class होते है । यह multiple Inheritance के विपरीत होता है।    

class A{ 
// code here
}
class B extends A{
// code here
}
class C extends A{
// code here
}
class D extends A{
// code here
}

4. Multiple Inheritance :-

जब एक से अधिक class को एक class द्वारा inherit किया जाता है तो उस inheritance को Multiple Inheritance कहते है । इसमे एक से अधिक class कि property को दूसरी class द्वारा inherit किया जाता है। इसमे एक से अधिक super class और एक Sub class होती है ।

Java class के साथ Multiple Inheritance को Support नही करती है। Note – जावा में interface का use करके multiple inheritance को support करा सकते है ।   Class के case में यदि दो super class के अंदर एसा method exist करता है जिसकी signature दोनो class में same हो तो class या sub class का object create करके जब हम उस method को call करने कि कोशिश करते है तो compiler error show करता है क्युंकि compiler नही जान पाता कि दोनो किस super class के method को call करना चाहते है तो यहाँ पर ambiguity problem होती है    

class A{
// code here
}
class B{
// code here
}
class C extends A,B{
// Does not supported in java
}

interface A{
//code here
}
interface B{
//code here
}
interface C extends A,B{
// that is supported

Final Word

तो दोस्तों आज मैंने आप को बताया की Types of Inheritance in Java in Hindi | How many types of Inheritance in Java क्या है|

तो दोस्तों मै आशा करता हूँ की आपको ये Post पसंद आई होगी। अगर आप को ये Post थोड़ी सी भी Useful/Helpful लगी हो Please Follow and Comment जरुर करे और इसे अपने दोस्तों के साथ Share करे! धन्यबाद|

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Exit mobile version