Multiple choice

class X implements Runnable { public static void main(String args[]) { /* Missing code? */ } public void run() {} } Which of the following line of code is suitable to start a thread ?

  1. Thread t = new Thread(X);

  2. Thread t = new Thread(X); t.start();

  3. X run = new X(); Thread t = new Thread(run); t.start();

  4. Thread t = new Thread(); x.run();

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

Option C is suitable to start a thread.