What is the result?
public class MyThread implements Runnable
{
public void run()
{
System.out.println("running");
}
public static void main(String args[])
{
Thread t= new Thread(new MyThread());
t.run();
t.run();
t.start();
}
}
- Compilation fails
- An Exception is thrown at runtime
- The code executes and prints \"running\"
- The code executes and prints \"runningrunning\"
- The code executes and prints \"runningrunningrunning\"
Correct Answer:
The code executes and prints "runningrunningrunning"
need an explanation for this answer? contact us directly to get an explanation for this answer