If a class implements two interfaces with default methods having the same signature, the compiler will throw an error unless the class ________ the conflicting method.

  • abstracts
  • hides
  • overrides
  • renames
In Java, if a class implements two interfaces with default methods having the same signature, it must provide an implementation for the conflicting method by using the @Override annotation to explicitly indicate that it is intended to override the method. This resolves the conflict and prevents a compilation error. Renaming, hiding, or making it abstract won't resolve the issue.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *