Default Method on Java 8 interfaces was originally designed to allow an existing interface to evolve — adding new methods to use the new version of the interface without requiring any changes (or even recompilation) to the existing classes that implement the interface.
Take Java’s java.util.list interface, which did not have a sort() method in Java SE 7 and added it in Java SE 8. So if I had written a MyList class in Java SE 7 that implemented the List
interface, I wouldn’t have needed to implement the sort() method; When I upgraded to JDK8, I suddenly found a method on the interface, so MyList had to implement that method and recompile it to continue using it, right? So there’s the default method. The list.sort () method above is a default method in Java SE 8. It provides a default implementation on the interface, so MyList automatically inherits the default implementation from the interface even if it does not provide an implementation of sort(). So MyList can continue to be used in Java SE 8 without recompiling.
Indeed, from the Java SE 8 design theme, default Method was designed to match the functional style of the JDK standard library. With default method, many older interfaces in the JDK have added new methods to accept FunctionalInterface arguments, making them easier to use in a functional style.
Java 8 interfaces, even with the default Method, are not yet a complete replacement for abstract classes. It cannot have state and can only provide the default implementation of public and virtual methods. Java 9 interfaces can already have static methods that are not public. Future Versions of The Java interface are likely to be more functional, perhaps to a greater extent, replacing scenarios where abstract classes are required.
If the ActionListener interface provides an empty default implementation for all methods, there is no need to provide a skeleton of an abstract class for the interface. Instead, write an abstract class whose implementations are all empty methods.