Complete the code to declare an interface named Printable.
public interface [1] { void print(); }
The interface name must be Printable as declared.
Complete the code to declare a class Document that implements Printable interface.
public class Document implements [1] { public void print() { System.out.println("Printing document"); } }
The class must implement the interface named Printable.
Fix the error in the class declaration to implement two interfaces: Printable and Showable.
public class Report implements [1] { public void print() { System.out.println("Printing report"); } public void show() { System.out.println("Showing report"); } }
Multiple interfaces are separated by commas in the implements clause.
Fill both blanks to complete the interface declarations and class implementing both.
interface [1] { void print(); } interface [2] { void show(); } class Presentation implements Printable, Showable { public void print() { System.out.println("Print slide"); } public void show() { System.out.println("Show slide"); } }
The interfaces are named Printable and Showable as used in the class.
Fill all three blanks to complete the code that uses multiple inheritance with interfaces and calls their methods.
interface [1] { void print(); } interface [2] { void show(); } class Report implements Printable, Showable { public void print() { System.out.println("Printing report"); } public void show() { System.out.println("Showing report"); } } public class Main { public static void main(String[] args) { [3] obj = new Report(); obj.print(); obj.show(); } }
The interfaces are Printable and Showable, and the variable type is the class Report.