Complete the code to declare an interface named Printable.
public interface [1] { void print(); }
The interface name must match the declaration. Here, Printable is the correct name.
Complete the code to make class Document implement the Printable interface.
public class Document [1] Printable { public void print() { System.out.println("Printing document..."); } }
extends instead of implements.In Java, a class implements an interface using the implements keyword.
Fix the error in the class by correctly overriding the print method from the Printable interface.
public class Report implements Printable { public void [1]() { System.out.println("Report printing..."); } }
The method name must exactly match the interface method name, including case sensitivity.
Fill both blanks to declare an interface and a class that implements it.
public interface [1] { void display(); } public class Screen [2] Displayable { public void display() { System.out.println("Displaying screen..."); } }
extends instead of implements for interfaces.The interface is named Displayable and the class uses implements to connect to it.
Fill all three blanks to create an interface, implement it in a class, and override the method.
public interface [1] { String getName(); } public class User [2] Named { @Override public String [3]() { return "User"; } }
extends instead of implements for interfaces.The interface is Named, the class User implements it, and overrides the getName method.