Type the Runnable-plus-Thread launch pattern (note: start(), not run())
Type the Runnable-plus-Thread launch pattern (note: start(), not run())
Answer
Runnable task = () -> System.out.println("running"); Thread t = new Thread(task); t.start(); // NOT t.run()
A lambda supplies run(). start() spawns a new thread that calls run(); t.run() would execute on the current thread with no concurrency.