Resolve a diamond problem of ConsoleWriter class. Override greeting method according to Printer interface implementation. Try to avoid code duplication.
Computer scienceProgramming languagesJavaCode organizationObject-oriented programmingClass hierarchiesInterfaces and abstract classes
Default methods
Resolve a diamond problem
Report a typo
Write a program in Java 17
class ConsoleWriter implements Printer, Notifier {
// override greeting method according to Printer default implementation
}
interface Printer {
default void greeting() {
System.out.println("Printer is ready");
}
}
interface Notifier {
default void greeting() {
System.out.println("Notifier is ready");
}
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.