abstract class vehicle {
abstract void start();
}
class Bike extends vehicle {
public void start() {
System.out.println("Starts with kick");
}
}
class Car extends vehicle {
public void start() {
System.out.println("Starts with key");
}
public static void main(String[] args) {
Bike bike = new Bike();
bike.start();
Car car = new Car();
car.start();
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter