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.
Loading...
Related Quiz
- What does the getConnection method of DriverManager class do?
- Which index of a multi-dimensional array represents the row index in Java?
- Imagine a scenario where you are developing a library, and you want to restrict the usage of some specific methods to the external world but allow them to be used inside the package. How would you implement this using access modifiers?
- In a multi-threaded server application, what could be a potential issue if each thread opens its own database connection via a socket?
- How does the wait() method differ from the sleep() method when working with threads?