English

Assertion: An interface in Java contains abstract and non-abstract methods. Reason: All methods in an interface must be implemented by any class that extends this interface. - Computer Science (Theory)

Advertisements
Advertisements

Question

Assertion: An interface in Java contains abstract and non-abstract methods.

Reason: All methods in an interface must be implemented by any class that extends this interface.

Options

  • Both Assertion and Reason are true and Reason is the correct explanation for Assertion.

  • Both Assertion and Reason are true but Reason is not the correct explanation for Assertion.

  • Assertion is true and Reason is false.

  • Both Assertion and Reason are false.

MCQ
Assertion and Reasoning
Advertisements

Solution

Assertion is true and Reason is false.

Explanation:

  • Assertion is True: In modern Java (since Java 8), interfaces are no longer limited to abstract methods. They can now contain non-abstract methods, specifically default, static, and (since Java 9) private methods that have a defined body.
  • Reason is False: Not all methods in an interface must be implemented. Default and static methods already have an implementation, so the class implementing the interface is not required to provide one. Additionally, a class implements an interface; it does not "extend" it (interfaces extend other interfaces).
shaalaa.com
  Is there an error in this question or solution?
2025-2026 (March) Official Board Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×