Skip to main content

Posts

Showing posts from December, 2017

Default Methods in Java 8

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 implements all the fu