Java 8 Default and static methods in Interfaces

Ashok Veer | May 22, 2020 | Be the first to comment!


Java 8 is come up with really good features likes Funtional interface, Lambda expression, Stream, static and default method in interface etc.
Before java 8 an interface in java can contain only abstract method so now java 8 allow having default and static methods.

Default methods are allowing developers to add new method with new functionality without affecting the classes that implements these interfaces.

Important points to remember

1] Interface can contain any number of default and static methods.

2] As per your need you can override the default method in child class which implements these interface.

0 comments:

Post a Comment

 
Copyright © 2019 techfloaters • All Rights Reserved.
Template Design by Ashok Veer ( veersoft solution)