Back To Java Interfaces Index
//program to create a default interface interface Vehicle { void startVehicle(); default void stopVehicle() { System.out.println("Vehicle is stopping"); } } class Car implements Vehicle { @Override public void startVehicle() { System.out.println("Car is starting"); } } public class defaultinterface { public static void main(String[] args) { Car car = new Car(); car.startVehicle(); car.stopVehicle(); } }