Quiz 3

Questions on how threads can be created

We'll cover the following...

Question # 1

Give an example of creating a thread using the Runnable interface?

The below snippet creates an instance of the Thread class by passing in a lambda expression to create an anonymous class implementing the Runnable interface.

        Thread t = new Thread(() -> {
            System.out.println(this.getClass().getSimpleName());
      
...