super Keyword in Java in Hindi | super(), Parent Constructor & this vs super | Java Course #26
Coding Center
0:00 / 0:00
super Keyword in Java in Hindi | super(), Parent Constructor & this vs super | Java Course #26
3 просмотра · 12 дней назад
Coding Center
7 подписчиков
3 просмотра · 12 дней назад
☕ super Keyword in Java in Hindi | Java Course #26
Java Programming for Beginners in Hindi के Episode #26 में हम Java के बहुत important OOP concept super keyword को practical coding examples के साथ step-by-step समझेंगे।
पिछली class में हमने Bank Management System OOP Mini Project बनाया था, जहाँ SavingsAccount के constructor में हमने यह code use किया था:
super(name, number, balance);
लेकिन super क्या है? यह Parent Class के constructor, variable और method के साथ कैसे काम करता है? इसी confusion को इस class में completely clear करेंगे।
🔥 इस वीडियो में आप सीखेंगे:
✅ super Keyword क्या है?
✅ super क्यों use करते हैं?
✅ super.variable
✅ super.method()
✅ super()
✅ Parent Class Constructor कैसे call होता है?
✅ Parameterized Parent Constructor
✅ Child और Parent Constructor Execution Order
✅ Implicit super() क्या है?
✅ Parent में No-Argument Constructor न हो तो क्या होगा?
✅ Multi-Level Inheritance में Constructor Order
✅ this vs super
✅ this() vs super()
✅ Method Overriding के साथ super.method()
✅ Practical Person → Student Example
✅ Bank Management Project में super() का use
🔥 super.variable
class Animal {
String name = "Animal";
}
class Dog extends Animal {
String name = "Dog";
void display() {
System.out.println(this.name);
System.out.println(super.name);
}
}
यहाँ:
this.name → Current object/class field
super.name → Parent class field
🔥 super.method()
अगर Child Class ने Parent Method को override किया है, फिर भी Parent implementation call करनी हो:
@Override
void sound() {
super.sound();
System.out.println("Dog is barking");
}
super.sound() Parent Class का method call करता है।
🔥 super() — Parent Constructor
class Dog extends Animal {
Dog() {
super();
System.out.println("Dog Constructor");
}
}
Output:
Animal Constructor
Dog Constructor
इससे हम Parent और Child Constructor के execution order को भी practically समझेंगे।
⚠️ Important Constructor Confusion
अगर Parent Class में केवल parameterized constructor है:
Animal(String name) {
System.out.println(name);
}
तो Child में सही Parent Constructor explicitly call करना पड़ सकता है:
Dog() {
super("Tommy");
}
🔥 Practical Example
class Person {
String name;
int age;
Person(String name, int age) {
this.name = name;
this.age = age;
}
}
class Student extends Person {
int marks;
Student(String name, int age, int marks) {
super(name, age);
this.marks = marks;
}
}
यहाँ:
super(name, age) → Parent Constructor
this.marks = marks → Current Student Object field
🧠 this vs super
this.variable → Current object field
super.variable → Parent field
this.method() → Current object method
super.method() → Parent implementation
this() → Same-class constructor
super() → Parent-class constructor
🎯 Assignment
Employee Parent Class और Developer Child Class बनाइए।
Developer में:
✅ programmingLanguage field
✅ Parameterized Constructor
✅ super(name, salary)
✅ display() Method Override
✅ super.display() call
✅ Programming Language display
Assignment complete होने पर comment करें:
🔥 super Keyword Assignment Done ✅
📚 JAVA OOP JOURNEY
Classes & Objects → Constructors → this → Encapsulation → Inheritance → Method Overriding → Polymorphism → Abstraction → Interface → OOP Mini Project → super Keyword
🎬 NEXT CLASS #27: Constructor Chaining in Java
👍 LIKE करें
💬 COMMENT करें
📤 SHARE करें
🔔 Coding Center को SUBSCRIBE करें
Coding Center — Learn • Practice • Grow
#Java #SuperKeyword #SuperKeywordInJava #JavaOOP
#ThisVsSuper #JavaInheritance #JavaConstructor
#ConstructorInJava #JavaInHindi #JavaTutorial
#JavaForBeginners #JavaProgramming #CoreJava
#LearnJava #CodingCenter #javacourse
super keyword in java
super keyword in java in hindi
what is super keyword in java
super keyword in java with example
java super keyword explained
super in java in hindi
super keyword example java
super() in java
super() in java in hindi
super constructor in java
super variable in java
super method in java
super.method in java
super.variable in java
parent constructor in java
how to call parent constructor in java
how to call superclass constructor in java
child class constructor in java
parent child constructor execution order
constructor execution order in java
implicit super constructor java
implicit super() in java
parameterized parent constructor java
super keyword inheritance java
super keyword method overriding
this vs super in java
this vs super in java in hindi
difference between this and super in java
this() vs super() in java
this and super keyword in java
java inheritance in hindi
java oop in hindi
java tutorial in hindi
java for beginners in hindi
core java in hindi
coding center java