सीधे मुख्य सामग्री पर जाएं

#54 What is Hierarchical Inheritance in Java | Hierarchical Inheritance क्या होता है ?

package com.sudhirtheindian2.java123;

class A{
void input(){
System.out.println("enter your name");
}

}
class B extends A{
void display(){
System.out.println("my name is sudhir");
}
}
class C extends A{
void show(){
System.out.println("my name is abhi");
}

}



public class hirarchy {
public static void main(String[] args) {
B b = new B();
C c = new C();
b.input();
b.display();
c.input();
c.show();






// What is hierarchical inheritance in java ?

// A inheritance which contain
// only one super class & multiple sub class

// and all sub class directly extends super class
// called hierarchial inheritance

// super---> sub 1
// super---> sub 2
// super---> sub 3
// super---> sub 4



//
}


}

टिप्पणियाँ

इस ब्लॉग से लोकप्रिय पोस्ट