Java program for super keyword(Access overridden/hidden methods of the super class)

class A

{

 void show(int a)

 {

  System.out.println(2*a);

 }

}

class B extends A

{

 void show(int k)

 {

  System.out.println(k*k);

 }

 void display()

 {

  show(5);

  super.show(7);

 }

}

class Super1b

{

 public static void main(String ar[])

 {

  B ob = new B();

  ob.display();

 }

}





Comments