If there is a single statement in a lambda function, we can omit defining the full code block for it:
new Thread(() -> System.out.println());
AFAIK The jls says that the lambda body has to be:
expression or a block. Having it like this:
new Thread(() -> throw new RuntimeException());
is neither and the compiler somehow informs you about that.
Declaring it like this:
new Thread(() -> {
throw new RuntimeException();
});
makes it a block. Here is the relevant part:
A block is a sequence of statements, local class declarations, and local variable declaration statements within braces.