~/ learn/ java-from-zero/ cards/ default, static & private interface methods
1 of 4

Type an interface default method

Type an interface default method

Answer

default void logInfo(String msg) { log("[INFO] " + msg); }

default methods have a full body. Implementing classes inherit this method and may override it with @Override. This was the key Java 8 addition that enabled backward-compatible API evolution.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/9bf4ac62-e755-4d28-abb4-e97b84c794cb/flashcard utf-8 LF