In Java 8, lambda expressions can be used in place of the "classic" programming style of providing an anonymous class implementation of a single abstract method interface. Lambda expressions require less code than anonymous class implementations and therefore offer a more natural style of programming. Below, we will demonstrate an implementation of a functional interface that contains one abstract method to generate a greeting.
->) that begins the implementation of the interface method. The Java code inside the expression is identical to the code in the anonymous inner class implementation.