Java OCA OCP Practice Question 801

Question

Which modifiers can be independently applied to an interface method? (Choose three.)

  • A. default
  • B. protected
  • C. static
  • D. private
  • E. final
  • F. abstract


A, C, F.

Note

An interface method is exactly one of three types: default, static, or abstract.

For this reason, Options A, C, and F are correct.

An interface method cannot be protected nor private because the access modifier is always public, even when not specified, making Options B and D incorrect.

Option E is also incorrect because final cannot be applied to static methods, since they cannot be overridden.

It can also not be applied to default and abstract methods because they are always able to be overridden.




PreviousNext

Related