Fill the gaps

Report a typo

Fill the gaps to complete this code:

class ThreadLocalExample {

    public static class MyRunnable implements _____ { // 1

        private final ThreadLocal<_____> threadLocal = new ThreadLocal<>(); // 2

        @Override
        public void run() {
            threadLocal.set((int) (Math.random() * 10));

            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }

            System.out.println(threadLocal._____); // 3
        }
    }

    public static void main(String[] args) throws InterruptedException {
        MyRunnable runnableInstance = new _____(); // 4

        Thread t1 = new Thread(_____); // 5
        Thread t2 = new Thread(runnableInstance);
        // start
        t1.start();
        t2.start();
        // wait for threads to end
        t1.join();
        t2.join();
    }
}
Match the items from left and right columns
1
2
3
4
5
get()
Integer
Runnable
runnableInstance
MyRunnable
___

Create a free account to access the full topic