最近因著之前看到的考題得不到解答,而一直把重心放在如何把java轉成applet,使我乎略了最重要的事情:我要考證照!!!
基本上這些題目是我在這兩天颱風假看考題時所遇到不會解的題目嘍!想說寫在這裡請大家幫幫忙嘍!^_^{#emotions_dlg.emotion_014}(感謝)

Collection(集合)-API←若有分類分錯也請多包含,謝謝^_^{#emotions_dlg.emotion_016}

第139題:

這題我搞不太懂他的Result的意思,及何為正確答案@@


第141題:

不懂、不懂啊!Arrays及TreeSet還比較知道可能是哪個Function的答案,但整題還需請大家救救我了......


第142題:

喵嗚~{#emotions_dlg.emotion_002}我還是不行啊~~API的題目真的好難Orz...

喵嗚~好多題都被吃掉了啊Orz...
我先存part 1 出來好嘍!{#emotions_dlg.emotion_015}

續之前Collection(集合)-API的問題......

第201題:
Given:
10. interface A { void x(); }
11. class B implements A { public void x() {} public void y() {} }
12. class C extends B { public void x() {} }
And:
20. java.util.List<A> list = new java.util.ArrayList<A>();
21. list.add(new B());
22. list.add(new C());
23. for (A a : list) {
24. a.x();
25. a.y();
26. }

What is the result?

A. The code runs with no output.
B. An exception is thrown at runtime.
C. Compilation fails because of an error in line 20.
D. Compilation fails because of an error in line 21.
E. Compilation fails because of an error in line 23.
F. Compilation fails because of an error in line 25.

為何第25行有error呢?

 

第227題:

Given:
23. Object [] myObjects = {
24. new Integer(12),
25. new String("foo"),
26. new Integer(5),
27. new Boolean(true)
28. };
29. Arrays.sort(myObjects);
30. for(int i=0; i<myObjects.length; i++) {
31. System.out.print(myObjects[i].toString());
32. System.out.print(" ");
33. }

What is the result?

A. Compilation fails due to an error in line 23.
B. Compilation fails due to an error in line 29.
C. A ClassCastException occurs in line 29.
D. A ClassCastException occurs in line 31.
E. The value of all four objects prints in natural order.

答案是C是因為第29行的語法有誤嗎?

 

第232題:


API的題目真的好難啊!拖拉題我更是不懂Orz...

 

第235題:

怎麼拉啊Orz...

 

第358題:

Given:
11. public class Person {
12. private name;
13. public Person(String name) {
14. this.name = name;
15. }
16. public int hashCode() {
17. return 420;
18. }
19. }

Which statement is true?

A. The time to find the value from HashMap with a Person key depends on the size of the map.
B. Deleting a Person key from a HashMap will delete all map entries for all keys of type Person.
C. Inserting a second Person object into a HashSet will cause the first Person object to be removed as a duplicate.
D. The time to determine whether a Person object is contained in a HashSet is constant and does NOT depend on the size of the map.

API的問題到此結束,感謝各位大大的相助^o^

arrow
arrow
    全站熱搜

    如雲 發表在 痞客邦 留言(19) 人氣()