The Sample program given below will check your knowledge of thread execution in Java.
The Sample program given below will check your knowledge of thread execution in Java.Given a sample code:
class Test extends Thread {
public void run() {
System.out.println("One");
System.out.println("Two");
}
private void method() {
System.out.println("Three");
}
public static void main(String args[]) {
Test t = new Test();
t.method();
t.start();
}
}
Which of the following statement is correct ?
(A) Print One Two Three
(B) Print Two Three One
(C) Print Three One Two
(D) Print Three One Two
(D)