0

Using inheritance,class ,functions writing java code for hobbys like cricket,reading all should display

22nd Feb 2019, 11:54 AM
Yash Bafna
Yash Bafna - avatar
2 ответов
0
class GrandParent {   int a;     GrandParent(int a) {     this.a = a;   } }   class Parent extends GrandParent {   int b;     Parent(int a, int b) {     super(a);     this.b = b;   }     void show() {     System.out.println("GrandParent's a = "+ a);     System.out.println("Parent's b      = "+ b);   } }   class Child {   public static void main(String[] args) {     Parent object = new Parent(8, 9);     object.show();   }
22nd Feb 2019, 12:11 PM
Yash Bafna
Yash Bafna - avatar
0
By this example i want to create two class one super and sub class and then display my hobbies such as cricket,reading ,writing etc
22nd Feb 2019, 12:12 PM
Yash Bafna
Yash Bafna - avatar