常州酌乒文化传播有限公司

當前位置:

JAVA認證歷年真題:SCJP考試真題和解析5

發(fā)表時間:2014/4/21 9:54:51 來源:互聯(lián)網(wǎng) 點擊關(guān)注微信:關(guān)注中大網(wǎng)校微信
關(guān)注公眾號

3。B

請查閱JAVA類庫。getID方法的返回值是“event type”。在認證考試中,總會有類似的書本以外的知識,這只能靠多實踐來增長知識了。

4. Which statement about listener is true?

A. Most component allow multiple listeners to be added.

B. If multiple listener be add to a single component, the event only affected one listener.

C. Component don?t allow multiple listeners to be add.

D. The listener mechanism allows you to call an addXxxxListener method as many times as is needed, specifying as many different listeners as your design require.

4。A、D

控件可以同時使用多個“addXxxxListener”方法加入多個監(jiān)聽器。并且當多個監(jiān)聽器加入到同一控件中時,事件可以響應多個監(jiān)聽器,響應是沒有固定順序的。

5.Give the following code:

public class Example{

public static void main(String args[] ){

int l=0;

do{

System.out.println(“Doing it for l is:”+l);

}while(--l>0)

System.out.println(“Finish”);

}

}

Which well be output:

A. Doing it for l is 3

B. Doing it for l is 1

C. Doing it for l is 2

D. Doing it for l is 0

E. Doing it for l is ?C1

F. Finish

5。D、F

本題主要考察考生對流程控制的掌握情況。這是當型循環(huán),條件為真執(zhí)行,條件為假則退出。循環(huán)體至少執(zhí)行一次,故會輸出D。循環(huán)體以外的語句總會被執(zhí)行,故輸出F。

6. Give the code fragment:

1) switch(x){

2) case 1:System.out.println(“Test 1”);break;

3) case 2:

4) case 3:System.out.println(“Test 2”);break;

5) default:System.out.println(“end”);

6) }

which value of x would cause “Test 2” to the output:

A. 1

B. 2

C. 3

D. default

6。B.C

在開關(guān)語句中,標號總是不被當做語句的一部分,標號的作用就是做為條件判斷而已,一旦匹配成功,就執(zhí)行其后的語句,一直遭遇break語句為止。(包括default語句在內(nèi))

7. Give incompleted method:

1)

2) { if(unsafe()){//do something…}

3) else if(safe()){//do the other…}

4) }

The method unsafe() well throe an IOException, which completes the method of declaration when added at line one?

A. public IOException methodName()

B. public void methodName()

C. public void methodName() throw IOException

D. public void methodName() throws IOException

E. public void methodName() throws Exception

7。D、F

IOException異常類是Exception的子類。根據(jù)多態(tài)性的定義,IOException對象也可以被認為是Exception類型。還要注意在方法聲明中拋出異常應用關(guān)鍵字“throws”。

8. Give the code fragment:

if(x>4){

System.out.println(“Test 1”);}

else if (x>9){

System.out.println(“Test 2”);}

else {

System.out.println(“Test 3”);}

Which range of value x would produce of output “Test 2”?

A. x<4

B. x>4

C. x>9

D. None

8。D

只有兩種情況:大于4時輸出“Test1”,小于等于4時輸出“Test3”。

9. Give the following method:

public void example(){

try{

unsafe();

System.out.println(“Test1”);

}catch(SafeException e){System.out.println(“Test 2”);

}finally{System.out.println(“Test 3”);}

System.out.println(“Test 4”);

Which will display if method unsafe () run normally?

A. Test 1

B. Test 2

C. Test 3

D. Test 4

9。A、C、D

在正常情況下,打印Test1、Test3、Test4;在產(chǎn)生可捕獲異常時打印Test2、Test3、Test4;在產(chǎn)生不可捕獲異常時,打印Test3,然后終止程序。注意finally后面的語句總是被執(zhí)行。

10. Which method you define as the starting point of new thread in a class from which new the thread can be excution?

A. public void start()

B. public void run()

C. public void int()

D. public static void main(String args[])

E. public void runnable()

10。B

線程的執(zhí)行是從方法“run( )”開始的,該方法是由系統(tǒng)調(diào)用的。程序員手工調(diào)用方法start(),使線程變?yōu)榭蛇\行狀態(tài)

相關(guān)鏈接JAVA認證考試報考指南  考試論壇 考試知道   考試動態(tài)

(責任編輯:fky)

2頁,當前第1頁  第一頁  前一頁  下一頁
最近更新 考試動態(tài) 更多>
广昌县| 桐乡市| 广元市| 区。| 西吉县| 纳雍县| 于都县| 农安县| 日土县| 亳州市| 剑川县| 溧水县| 三原县| 肥东县| 兰州市| 肇源县| 宁陵县| 平远县| 碌曲县| 浑源县| 阜宁县| 溆浦县| 邹城市| 龙山县| 合阳县| 瓮安县| 广元市| 武平县| 余姚市| 阿图什市| 晋城| 五莲县| 阿拉善左旗| 诸暨市| 霍林郭勒市| 垦利县| 墨玉县| 和林格尔县| 太康县| 博兴县| 平原县|