What are default methods?


Default methods are methods defined on an interface. They were introduced in Java 1.8. Before Java 1.8, interfaces could only have abstract methods, meaning that interfaces only provided the contract (the signature of the method) and the actual implementation (functionality) had to be provided in a class implementing that interface. With the default methods, the functionality (implementation) can be provided on interface level.

0 answers