56、Given the uncompleted method:
1)
2) { sUCcess = connect();
3) if (success==-1) {
4) throw new TimedOutException();
5) }
6)}
TimedOutException is not a RuntimeException. Which can complete the method of declaration when added at line 1?
A. public void method()
B. public void method() throws Exception
C. public void method() throws TimedOutException
D. public void method() throw TimedOutException
E. public throw TimedOutException void method()
(bc)
題目:給出下面的不完整的方法:
…
TimedOutException 不是一個RuntimeException。下面的哪些聲明可以被加入第一行完成此方法的聲明。
假如程序在運行的過程中拋出異常,而這個異常又不是RuntimeException或者Error,那 么程序必須捕捉這個異常進行處理或者聲明拋棄(throws)該異常,捕捉異??梢允褂胻ry{}catch(){}語句,而拋棄異常在方法聲明是聲明,在方法的聲明后面加上throws XxxxException,拋棄多個異常時在各異常間使用逗號(,)分隔,題目中的程序在運行時拋出的不是一個RuntimeException,所有必須捕捉或者拋棄,而程序又沒有捕捉,所有應該在方法聲明中聲明拋棄。由于Exception是所有異常的父類,所有當然也可以代表RuntimeException了。
57、Which of the following answer is correct to eXPRess the value 10 in hexadecimal number?
A. 0xA
B. 0x16
C. 0A
D. 016
(a)
題目:下面的哪些答案可以正確表示一個十六進制數字10。
十六進制數以0x開頭,以0開頭的是八進制數。十六進制表示中的a,b,c,d,e,f依次為10,11,12,13,14,15。
58、Which statements about thread are true?
A. Once a thread is created, it can star running immediately.
B. To use the start() method makes a thread runnable, but it does not necessarily start immediately.
C. When a thread stops running because of pre-emptive, it is placed at the front end of the runnable queue.
D. A thread may cease to be ready for a variety of reasons.
(bd)
題目:有關線程的哪些敘述是對的。
A. 一旦一個線程被創建,它就立即開始運行。
B. 使用start()方法可以使一個線程成為可運行的,但是它不一定立即開始運行。
C. 當一個線程因為搶先機制而停止運行,它被放在可運行隊列的前面。
D. 一個線程可能因為不同的原因停止(cease)并進入就緒狀態。
一個新創建的線程并不是自動的開始運行的,必須調用它的start()方法使之將線程放入可運行態(runnable state),這只是意味著該線程可為JVM的線程調度程序調度而不是意味著它可以立即運行。線程的調度是搶先式的,而不是分時間片式的。具有比當前運行線程高優先級的線程可以使當前線程停止運行而進入就緒狀態,不同優先級的線程間是搶先式的,而同級線程間是輪轉式的。一個線程停止運行可以是因為不同原因,可能是因為更高優先級線程的搶占,也可能是因為調用sleep()方法,而即使是因為搶先而停止也不一定就進入可運行隊列的前面,因為同級線程是輪換式的,它的運行可能就是因為輪換,而它因搶占而停止后只能在輪換隊列中排隊而不能排在前面。
59、The method resume() is responsible for resuming which thread's execution?
A. The thread which is stopped by calling method stop()
B. The thread which is stopped by calling method sleep()
新聞熱點
疑難解答