Bird
0
0

Which of the following is TRUE about default methods in Java interfaces?

easy📝 Conceptual Q2 of 15
Java - Interfaces
Which of the following is TRUE about default methods in Java interfaces?
ADefault methods can have private access modifier.
BDefault methods can be overridden by implementing classes.
CDefault methods must be abstract.
DDefault methods cannot call other interface methods.
Step-by-Step Solution
Solution:
  1. Step 1: Recall default method properties

    Default methods provide a body and can be overridden by classes implementing the interface.
  2. Step 2: Evaluate each option

    Private access is not allowed for default methods; they are implicitly public. They are not abstract. They can call other interface methods.
  3. Final Answer:

    Default methods can be overridden by implementing classes. -> Option B
  4. Quick Check:

    Overriding default methods = Allowed [OK]
Quick Trick: Default methods are concrete and overridable [OK]
Common Mistakes:
  • Confusing default methods with abstract methods
  • Thinking default methods can be private

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes