Journey Towards Java Default Methods

Report a typo

Consider the following code snippet:

public interface Vehicle {
    default void getDescription() {
        System.out.println("Vehicle");
    }
}
public class Truck implements Vehicle {
    public void getDescription() {
        System.out.println("Truck");
    }
}

In this example, what is accurate about the default method in the interface and the method in the class that implements the interface?

Select one or more options from the list

Create a free account to access the full topic