Multiple choice technology programming languages

What is the output for the below code ? class A implements Runnable{ public void run(){ System.out.println("run-a"); } } 1. public class Test { 2. public static void main(String... args) { 3. A a = new A(); 4. Thread t = new Thread(a); 5. t.start(); 6. t.start(); 7. } 8. }

  1. run-a

  2. run-a run-a

  3. Compilation fails with an error at line 6

  4. Compilation succeed but Runtime Exception

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

Calling start() on a Thread that has already been started is illegal and causes it to throw an IllegalThreadStateException at runtime. The code itself is syntactically valid and compiles without error.