Vidyalelo
Java Programming · Q51

Threads

Programming · Java Programming · question 51

Q51

What will be output of the following program code? public class Test implements Runnable public void run() System.out.print("go"); public static void main(String arg[]) Thread t = new Thread(new Test()); t.run(); t.run(); t.start();

A.
Compilation fails.
B.
An exception is thrown at runtime.
C.
"go" is printed
D.
"gogogo" is printed
Answer
E.
"gogo" is printed

Answer: Option D

Solution

Answer: Option D
No explanation is given for this question Let's Discuss on Board