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








Question

What modifiers are implicitly applied to all interface methods? (Choose all that apply)

  1. protected
  2. public
  3. static
  4. void
  5. abstract
  6. default




Answer



B.

Note

All interface methods are implicitly public, so option B is correct. A is wrong.

Interface methods may be declared as static or default but are never implicitly added.

D is incorrect-void is not a modifier.

E is wrong, prior to Java 8 all interface methods would be assumed to be abstract.

Java 8 includes default and static methods for interface, you cannot assume the abstract modifier will be implicitly applied to all methods by the compiler.