QuestionQ46

Java Object-Oriented Approach

Which two of these interface declarations compile?

Choose two
  • A
  • B
  • C
  • D
  • E
  • F
Explanation

Interface default methods may have bodies, while ordinary public interface methods may be abstract. Interface fields are implicitly public, static, and final, so explicitly declaring those modifiers is valid. Private interface methods are also allowed when they provide a body. Therefore, the valid declarations are A and D.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!