What are default methods?

1 answers

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.

shilpigupta22 shilpigupta22 [Author] 7 months ago votes 0