Share on Google+Share on Google+

SCJP Module-8 Question-10

Advertisement
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

Answer:

(D)

Advertisements

Posted on: July 15, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.