문제

Nothing seems weird here: 2Classes. Interface.java and Lambdas.java

public class Lambdas {
  public static void main(String[] args) {
    new Lambdas().start();
  }

  public void start(){
    Interface f = () -> Interface{System.out.println("test");}
  }
}

public interface Interface {
     void test();
}

I get error: Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - cannot find symbol symbol: variable Interface location: class lambdas.Lambdas . I don't know why.

P.S. Just arrived home from Java Day 2014 , I use their examples - with netbeans

도움이 되었습니까?

해결책

Your syntax is wrong;

Interface f = () -> System.out.println("test");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top