K
K
krembrule20162018-11-12 18:35:34
Java
krembrule2016, 2018-11-12 18:35:34

Why do lambda expressions throw an error?

Good afternoon!
I have a strange reaction to lambda expressions in my NetBeans environment.
5be99db0000fb181390955.png
JDK 1.8.0
What could be wrong? Where do I slow down?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DarkJn, 2018-11-15
@krembrule2016

Because you can’t just take and write a lambda)) like any other expression.
Try like this for example:

class Foo {
    public static void main(String[] args) {
        Runnable r = () -> System.out.println("Hello world!!");
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question