OCA Java SE 8 Class Design - OCA Mock Question Class Design 17


Which statements are true about the following code? (Choose all that apply)

     1: interface Printable { 
     2:   public abstract void print(); 
     3: } 
     4: public interface Formattable extends Printable { 
     5:   public void format(); 
     6: } 
  1. The Formattable interface doesn't compile.
  2. A class that implements Printable must override the print() method.
  3. A class that implements Formattable inherits both the print() and format() methods.
  4. A class that implements Formattable only inherits the format() method.
  5. An interface cannot extend another interface.




The code compiles without issue, so A is wrong.

B is incorrect, since an abstract class could implement Printable without the need to override the print() method.

C is correct; any class that implements Formattable automatically inherits its methods, as well as any inherited methods defined in the parent interface.

Since C is correct, D is incorrect.

An interface can extend multiple interfaces, so option E is incorrect.