The Sample program given below will check your understanding of thread execution in Java.
The Sample program given below will check your understanding of thread execution in Java.Given a sample code:
public class Test implements Runnable {
public static void main(String[] args) throws Exception {
Thread t = new Thread(new Test());
t.start();
System.out.print(" Started");
t.join();
System.out.print(" Joined");
}
public void run() {
System.out.print(" Run");
}
}
Which of the following statement is correct ?
(A) Print "Run Started Joined"
(B) Print "Started Run Joined"
(C) Print "Joined Started Run"
(D) Print "Joined Run Started"
(B)