Bird
0
0

Which of the following statements about Java interfaces is true?

easy📝 Conceptual Q1 of 15
Java - Interfaces
Which of the following statements about Java interfaces is true?
AInterfaces can have instance variables.
BInterfaces cannot extend other interfaces.
CInterfaces can be instantiated directly using the new keyword.
DInterfaces can contain method implementations using default methods.
Step-by-Step Solution
Solution:
  1. Step 1: Understand interface capabilities

    Java interfaces can have default methods with implementations since Java 8.
  2. Step 2: Evaluate each option

    Interfaces cannot have instance variables (only constants), cannot be instantiated directly, and can extend other interfaces.
  3. Final Answer:

    Interfaces can contain method implementations using default methods. -> Option D
  4. Quick Check:

    Interface default methods = B [OK]
Quick Trick: Interfaces can have default methods with code since Java 8 [OK]
Common Mistakes:
  • Thinking interfaces can have instance variables
  • Trying to instantiate interfaces directly
  • Believing interfaces cannot extend other interfaces

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes