欧美精品在欧美一区二区少妇,久久久久成人影视,99热在线精品呀,草莓视频手机在线观看

當(dāng)前位置:

JAVA認(rèn)證公共基礎(chǔ)知識(shí)指導(dǎo)練習(xí)題(1)

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

1:

Which two CANNOT directly cause a thread to stop executing? (Choose Two)

A.Existing from a synchronized block

B.Calling the wait method on an object

C.Calling notify method on an object

D.Calling read method on an InputStream object

E.Calling the SetPriority method on a Thread object

Answer:AC。同55題

2:

public class SyncTest{

public static void main(String[] args) {

final StringBuffer s1= new StringBuffer();

final StringBuffer s2= new StringBuffer();

new Thread ()  {

public void run() {

synchronized(s1) {

s2.append(“A”);

synchronized(s2) {

s2.append(“B”);

System.out.print(s1);

System.out.print(s2);

}

}

}

}.start();

new Thread() {

public void run() {

synchronized(s2) {

s2.append(“C”);

synchronized(s1) {

s1.append(“D”);

System.out.print(s2);

System.out.print(s1);

}

}

}

}.start();

}

}

Which two statements are true? (Choose Two)

A. The program prints “ABBCAD”

B. The program prints “CDDACB”

C. The program prints “ADCBADBC”

D. The output is a non-deterministic point because of a possible deadlock condition

E. The output is dependent on the threading model of the system the program is running on.

Answer:DE

3:

What will happen when you attempt to compile and run the following code?

public class Test{

int i = 0;

public static void main(String argv[]) {

Test t = new Test();

t.myMethod();

}

public void myMethod(){

while(true) {

try {  wait();

}catch (InterruptedException e) {}

i++;

}

}

}

A. Compile time error, no matching notify within the method.

B. Compile and run but an infinite looping of the while method.

C. Compilation and run without any output.

E. Runtime Exception "IllegalMonitorStatException".

Answer: E

Note: The wait/notify protocol can only be used within code that is synchronized. In this case calling code does not have a lock on the object(not synchronized) and will thus cause an Exception at runtime.

編輯推薦:

JAVA認(rèn)證公共基礎(chǔ)知識(shí)指導(dǎo)練習(xí)題匯總

JAVA認(rèn)證考試報(bào)考指南 / 更多JAVA考試模擬試題

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

2頁,當(dāng)前第1頁  第一頁  前一頁  下一頁
最近更新 考試動(dòng)態(tài) 更多>
99久久国产精品免费消防器材| 亚洲欧美国产高清vA在线播放| 青草av top| heyzo久久| 咸人欧美一区二区三区| 欧美色图亚洲精品粉嫩| 欧美亚洲最新地址| 亚洲一区二区三千四千| 性虎精品无码av导航| 日本xxx在现欢看| 日本欧美在线看| 日韩大逼淫荡熟人妻| 国产成人动作片| 亚洲一区二区色图| 熟妇hd| 大香蕉 精品 久久| 黄色网页在线免费观看| 精品天堂在线| 日本人妻丰满熟妇| 国产精品欧美日韩涩爱| 国产97免费| 久久久精品少妇3p| 久久精品一本五月| 麻豆影视三级片| 99二区| 中国女人内射6XXXXXWWW| 奇米网| 日本免费费视频| 毛片成人在线观看| 国产91在线精品| 日韩狠狠躁久久精品| 久久久精品男人亚洲| 国产偷v国产偷v亚洲高清| 黄色美女视频高潮喷水| 国产麻豆精品一区二区三区| 亚洲色图色色网| 亚洲精品无码国产一级| 日韩的黄色网站| 97人人超碰国产精品最新| 亚色.com| 亚洲自慰久久久|