10. Vehicle and Car


class Vehicle {

 void start() {

 System.out.println("Vehicle started");

 }

}

class Car extends Vehicle {

 void step() {

 System.out.println("Car started");

 }

 public static void main(String[] args) {

 Car obj = new Car();

 obj.start();

 obj.step();

 }

}

Comments

Popular posts from this blog

Interface with Rectangle

Multiple interface