Multiple choice

Which one of the following is the correct structure to create and run a thread?

  1. class MyClass extends Runnable { public void run() { } }

  2. class MyClass implements Thread { public void run() { } }

  3. class Thread MyClass { public void run() { } }

  4. class MyClass extends Thread { public void run() { } }

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

The correct structure is: class MyClass extends Thread {       public void run()       {       } }