广元煌褂旅行社

當(dāng)前位置:

java認(rèn)證模擬試題及答案4

發(fā)表時(shí)間:2015/9/10 10:52:34 來(lái)源:互聯(lián)網(wǎng) 點(diǎn)擊關(guān)注微信:關(guān)注中大網(wǎng)校微信
關(guān)注公眾號(hào)

Question: 21

What will be output after execution of the following code:

outer: for(int i=0;i<3; i++)

inner: for(int j=0;j<2;j++)

{

if(j==1) continue outer;

System.out.println(j+ ?and ?+i);

}

A. 0 and 0

B. 0 and 1

C. 0 and 2

D. 1 and 0

E. 1 and 1

F. 1 and 2

G. 2 and 0

H. 2 and 1

I. 2 and 2

Explanation:

The continue statement is used to skip over and jump to the end of the loop body. Then if j equals to 1 it will jump to the end of the inner loop body.

Correct Answer: A,B,C 21 of 60

Question: 22

Given the following code:

switch (m)

{

case 0: System.out.println(Condition 0);

case 1: System.out.println(Condition 1);

case 2: System.out.println(Condition 2);

case 3: System.out.println(Condition 3);break;

default: System.out.println(Other Condition);

}

Which values of m will cause Condition 2 is output?

A. 0

B. 1

C. 2

D. 3

E. 4

F. None

Explanation:

In the block of switch, if there is no break sentence in one case the following sentences will be executed.

Correct Answer: A,B,C 22 of 60

Question: 23

Which method is called when the browser returns to the page containing the applet after moving to another URL?

A. init()

B. start()

C. stop()

D. destroy()

Explanation:

The start() runs whenever the applet becomes visible, such as when the browser returns to the page containing the applet after moving to another URL or the browser is restored after being iconized.

Correct Answer: B 23 of 60

Question: 24

If a thread calls the wait() method, which methods can make it continue to run?

A. join()

B. resume()

C. notify()

D. notifyAll()

E. high priority thread is ready

Explanation:

If a thread issues a wait() call it will pause execution until another thread issues a notify() or notifyAll() call. The pair of the methods are provided for thread communication.

Correct Answer: C,D 24 of 60

Question: 25

Which method is used to define the execution body of a thread?

A. start()

B. init()

C. run()

D. main()

E. synchronized()

Explanation:

The threads will always begin executing at the run() method, which contains the definition of the execution body.

Correct Answer: C 25 of 60

Question: 26

Which keyword is used to allow interaction with the lock flag?

A. native

B. static

C. synchronized

D. abstract

Explanation:

Every object has a lock flag. The synchronized keyword enables interaction with the flag, which allow exclusive access to that object.

Correct Answer: C 26 of 60

Question: 27

Which modifiers are legal in Java?

A. private

B. public

C. protected

D. protect

E. friend

Explanation:

The public, private, protected and no modifier are legal modifiers. The friend and protect are illegal in Java.

Correct Answer: A,B,C 27 of 60

編輯推薦

JAVA認(rèn)證考試報(bào)考指南 / 更多JAVA考試資料

(責(zé)任編輯:zyc)

2頁(yè),當(dāng)前第1頁(yè)  第一頁(yè)  前一頁(yè)  下一頁(yè)
最近更新 考試動(dòng)態(tài) 更多>
栖霞市| 海伦市| 邢台县| 柳河县| 望奎县| 靖江市| 大名县| 梅州市| 绥滨县| 五家渠市| 南丹县| 长岭县| 永丰县| 乌什县| 南平市| 都江堰市| 元氏县| 界首市| 连城县| 淮阳县| 隆安县| 梁平县| 永兴县| 璧山县| 廉江市| 娄底市| 扬中市| 柳河县| 乃东县| 漳浦县| 白水县| 兴宁市| 松桃| 麟游县| 铜梁县| 兰溪市| 雅安市| 安阳市| 普安县| 楚雄市| 文安县|