Threads with lambdas and runnable in Java
Your code is fine, but neither the question nor your answer have anything to do with threads. In order to run two separate threads, you need to create a Thread object with your runnable, rather than just calling myRunnable.run(). The first runnable returns to the scope of your main() method before the second is executed, i.e. they are sequential and exist in a single thread.