5 B. Write a java program to implement method overriding

 Program :


class college 

{

 public void move() 

{

  System.out.println("College is open");

 }

}

class univ extends college 

 

{  

 public void move()

 {

super.move();

  System.out.println("University is open too");

 }

}

public class stud {

 public static void main(String args[]) {

  college a = new college();

  college b = new univ();

  //a.move();

  b.move();

 }

}

Comments

Popular posts from this blog

Program using Light Sensitive Sensors on Tinkercad

Custom Buttons in Android

Create an android app that demonstrates Activity Lifecycle and Instance State.