Adding new methods in interface s always break the implementation in class. So Java 8 come up with new feature which propose a mechanism to extend existing interfaces by adding new methods without breaking existing implementation thus, achieved the backward compatibility. Default methods is the feature which helps you to extend existing interfaces . If added method in interface provides the default implementation then no implementing Class get affects. Default methods enable you to add new functionality to the interfaces of your libraries and ensure binary compatibility with code written for older version of those interfaces. An implementing class can override the default implementation defined in implemented interface and add its own implementation. To understand it with example, lets say there is ABC company which wants to launch their smart Radios in market, so they have developed SmartRadio interface(contract) and ABCRadio final product im...
Read and understand java programming language and its core concepts. Blog is carefully written and crafted to explain language concepts with easy way, so you can chase java!