2009年2月26日 星期四

第239題

Given:
1. public class TestOne{
2. public static void main(String[] args) throws Exception{
3. Thread.sleep(3000);
4. System.out.println("sleep");
5. }
6. }

What is the result?

A. Compilation fails.
B. An exception is thrown at runtime.
C. The code executes normally and prints "sleep".
D. The code executes normally, but nothing is printed.

答案:C
參考:13-2 Java執行緒與Thread類別

沒有留言:

張貼留言