Welcome To Tips Arena
Hello guys humne apni peechli post main seekha tha Java Methods ke bare main or ab hum seekhenge Java Inheritence ke bare main, to dosto jada time na lete huye hum seedhe chalte hain apne topic par.
Java Inheritance Full Guide In Hindi
Friends agar hum baat kare java inheritance ki, dosto ye ek father and son like relation ka hota hai, dosto jesa ki father ki property par son ke rights hote hain jise son apne tarike se use kar sakta hai dosto thik wese hi agar hum chahe to ek class ko father (super class) bna sakte hain, or second class ko son (sub class) bna sakte hain. dosto aisa karne se ek class dusri class ki properties (methods, variables etc) ko access kar sakti hain. friends aisa karne se son (sub class) ko father (super class) ki whole property (methods, variables etc) ko access karne ke rights praapt kar sakte hain.
Friends aap maan lijiye humne koi class pehle se create ki huyi hai or is class man kuch aise methods hain jo humari second class man bhi kaam aa sakte hain. dosto in methods ko repeat karne ki bajaye hum apni purani class main se un methods ko access kar sakte hain. friends aisa karne ke jo class methods ko access karna chahti hai use second class ke sub class banna hoga. dosto sub class banne ke liye humari class ko us second class ko extend karna hoga, dosto isi chij ko hum inheritance kehte hain.
Friends agar hum chahe to Inheritance se ek hi code ko repeat karne ki problem se bach sakte hain. dosto inheritance ki is khasiyat ko re usability kehte hain. iska matlab ki hum ek hi code ko bar bar different jgah par reuse kar sakte hain.
Friends jab koi ek class dusri class ko inherit karna chahti hai to vo extends keyword use karti hai. or agar hum chahte hain ki humare through banayi huyi class ko koi dusri class inherit na kare iske liye hum class ke name se pehle final keyword lga dete hain. dosto jin classes ke name se pehle final keyword hota hai unhe inherit nahi kiya ja sakta hai.
Friends koi bhi class bas ek hi class ko extend kar sakti hai or dosto jab bhi koi class ek se jada classes ko extend karti hai to usko multiple inheritance kehte hain. or friends hum aapko batate hain ki java main multiple inheritance allow nahi hote hain. friends iski jgah par hum multilevel inheritance implement kar sakte hain.
Friends jis class ko inherit kiya jata hai vo super class kehlati hai. or jo class inherit karti hai vo sub class kehlati hai. dosto agar hum yaha par dhyan de to isme ek chij hai vo ye ki sub class super class ke sabhi methods or variables ko access nahi kar sakti hai jo methods public or protected declare kiye huye hote hain unhe hi sub class access kar sakti hai. friends super class ke kisi bhi private member ko sub class access nhi kar sakti hai. dosto agar super class ne kisi class ko extend kar rakha hai to us class ke sabhi public or protected members ko humari class use kar sakti hai.
Java Inheritance Types in Hindi
Friends hum aapko bta de ki java main 3 trah ke inheritance ko use kiya jata hai. dosto humari application ke liye hume jo suitable lage hum wahi tarika use kar sakte hain. dosto hum aapko ab in 3 tariko ke bare main batate hain.
Single Inheritance In Hindi
Friends single inheritance main ek class kisi bhi dusri class ko extend karti hai. dosto is trah ke inheritance ka use basic programming main kiya jata hai.
Multilevel Inheritance In Hindi
Friend ab agar hum baat kare multilevel inheritance ki to dosto isme ek class dusri class ko extend karti hai or dusri class tisri class ko extend karti hai.
Hierarchical Inheritance In Hindi
Friends ab hum baat karenge hierarchical inheritance ki dosto isme ek class ko bahut sari classes extend karti hain. dosto is trah inheritance ka use tab kiya jata hai jab super class ke task ke kayi sub task hote hain.
Inheriting A Class In Hindi
Friends agar hum kisi class ko inherit karna chahte hain to hum extends keywords use karte hain. agar hum apni class ke name ke baad extends keywords lgate hain or uske baad hum jis class ko inherit karna chahte hain us class ka name likhte hain. friends Inheritance ka example aapko batate hain.
class A
{
public void display()
{
System.out.println("This is A class");
}
public static void main(String args[])
{
display();
}
}
class B extends A
{
public static void main(String args[])
{
display();
}
}
Final Words
To dosto ye thi humari aaj ki post agar aapko humari ye post pasand aayi ho to please share jarur kijiyega or agar aapki is post se related koi query ya suggestion hain to aap hume comment box main comment karke bta sakte hain Thanks..
i found your article very intresting. really nice post. keep posting this type of important post. lots of love from rajasthan
ReplyDeletealso help me to improve my backlinking i am adding my website link.
Tramadol 50mg
ReplyDeletejavacodegeeks java
welookups javascript
Your article is very nice. Everything is clear explained. Inheritance in Java
ReplyDelete300mb mkv movies download
ReplyDeleteIf you wants to be a successful java programmer than you can read some basics about java in hindi.
ReplyDeletefor easy hindi typing try online hindi typing
ReplyDeleteHi friends agar kisi ko Programming seekhni hi to aap mere blog digital tech mong par visit kar sakte hai
ReplyDeleteNice Article sir sum budy Knowledge Go Programming Language Introduction In Hindi
ReplyDeletego to my website