Multiple choice

FirstTh th=new FirstTh(); Thread sm=new Thread(th).start(); Which of the following statements is correct with respect to the above code?

  1. FirstTh is a simple class.

  2. FirstTh is a class that inherits from Thread class.

  3. FirstTh is a class that implements from Thread class.

  4. FirstTh is a class that implements Runnable interface.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Here FirstTh must be a class which implements Runnable interface. Because the statements FirstTh th=new FirstTh(); Thread sm=new Thread(th).start(); Are used to create a thread by implementing Runnable interface.