हिंदी

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

प्रश्न

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.

विकल्प

  • 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
अभिकथन और तर्क
Advertisements

उत्तर

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
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2025-2026 (March) Official Board Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×