Interface default and static methods

  • An interface can be expanded without all legacy implementation classes having to create implementation
  • Default method is mandatory for multiple inheritance where multiple interfaces share the same method signature
  • Default method eliminates the need for abstract class because common implementations are already implemented

If l is an instance of ArrayList, then

  • l instanceof List is true
  • List.class.isInstance(l) is true
  • List.class.isAssignableFrom(ArrayList.class) is true

Discourage to use public and abstract

(public, abstract) Interface { (public, abstract) func1 (); (public) (static) class {}; }