+ 3

Answer my question

In code i want to eliminate the void call method from the class B and write the method call disp(); and super.disp(); in the main method can i write and if yes and how can i write plz tell me class A { int no; void disp() { System.out.println("super class method called"); System.out.println("value of no in super class is:"+no); } } class B extends A { int no; B(int a,int b) { no=a; super.no=b; } void disp() { System.out.println("base class method called"); System.out.println("value of no in base class is:"+no); } void call() { disp(); super.disp(); } } class Main { public static void main(String args[]) { B obj=new B(10,20); obj.call(); } }

1st Sep 2018, 3:47 AM
Devang H Baroliya
Devang H Baroliya - avatar
1 Respuesta
1st Sep 2018, 4:37 AM
NimWing Yuan
NimWing Yuan - avatar