Mark interface as FunctionalInterface - Java Lambda Stream

Java examples for Lambda Stream:Functional Interface

Description

Mark interface as FunctionalInterface

Demo Code


public class LamdaMain1 {
  public static void main(String[] args) {
    InnerInterface innerInterface = (a, b) -> System.out.println("Sum:" + (a + b));
    innerInterface.sum(2, 3);/*from w w  w. j  ava2  s .c  o m*/
  }

  @FunctionalInterface
  interface InnerInterface {
    void sum(int a, int b);
  }

}

Related Tutorials