Java examples for Object Oriented Design:interface
Use default methods is to declare optional methods in an interface.
interface Named { void setName(String name); /*from w w w .ja va 2 s . com*/ default String getName() { return "John Doe"; } default void setNickname(String nickname) { throw new UnsupportedOperationException("setNickname"); } default String getNickname() { throw new UnsupportedOperationException("getNickname"); } }