Home Tutorial Java Scjp Part8 SCJP Module-8 Question-8

 
 

Share on Google+Share on Google+
SCJP Module-8 Question-8
Posted on: July 15, 2010 at 12:00 AM
Advertisement
The sample program given below will test your knowledge about the sleep() method in Java.

Given a sample code:

public class Test {
public static void main(String[] args) throws Exception {
System.out.println("inside main");
Thread.sleep(2000);
System.out.println("thread sleep");
}
}

Which of the following statement is correct ?

(A) Print "inside main" and "thread sleep"
(B) Compilation fails.
(C) An exception is thrown at runtime.
(D) Print "thread sleep" and "inside main"

Answer:

(A)

Advertisement

Related Tags for SCJP Module-8 Question-8:


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.

Posted on: July 15, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com