Monthly Archives: December 2016

Java 8 : Lambda in Functional Interfaces

Lambda expressions in Java is usual written using syntax (argument) -> (body).

Functional Interface is an interface with just one abstract method declared in it.

Example:

ActionListener Interface
Runnable Interface
We generally use Anonymous inner classes to instantiate objects of functional interface but with the help of Lambda expressions, this can be simplified.

1

 

 

 

 

 

 

 

Output:

2

Advertisements

Leave a comment

Filed under Java