Bird
0
0

In Java, which keyword must be used in a class declaration to specify that it adheres to an interface's contract?

easy📝 Conceptual Q2 of 15
Java - Interfaces
In Java, which keyword must be used in a class declaration to specify that it adheres to an interface's contract?
Aimplements
Bextends
Cinherits
Dimports
Step-by-Step Solution
Solution:
  1. Step 1: Understand interface implementation

    In Java, a class uses a specific keyword to indicate it implements an interface.
  2. Step 2: Identify the correct keyword

    The keyword implements is used to declare that a class implements an interface.
  3. Final Answer:

    implements -> Option A
  4. Quick Check:

    Keyword for interface implementation is implements [OK]
Quick Trick: Use 'implements' to link class and interface [OK]
Common Mistakes:
  • Using 'extends' instead of 'implements' for interfaces
  • Confusing 'imports' with interface implementation
  • Using 'inherits' which is not a Java keyword

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes