Question

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

Was it helpful?

Solution

Your syntax is wrong;

Interface f = () -> System.out.println("test");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top