【正文】
20. if ((b2 = true) amp。 17. } else { 18. (some)。 x++) { 6. if(x==3) continue。 16. } 17. } 18. private void go2(int x) { assert (x 0)。 17. throw new IOException()。 } void doThree(int z) { doTwo(z)。 B. static int[] x = {7,6,5,4}。 4. class InnerTriangle { 5. public int base。 7. ()。 }, Sub 類沒有域 a。 } 4. } ... 11. class Sub extends Super { 12. public Sub(int a) { super(a)。 } } 12. class Dog extends Animal { 13. public String noise() { return bark。 (b )。 } D. class Man { private Dog bestFriend。 QUESTION 33 A pany that makes Computer Assisted Design (CAD) software has, within its application, some utility classes that are used to perform 3D rendering tasks. The pany39。 Spring s2。 QUESTION 31 Given: 1. interface A { public void aMethod()。第八行結(jié)束時(shí), doSomethingElse 函數(shù)將全局變量 o 的引用改為 null,即 A 不在被變量引用,此時(shí) A 可被 GC 回收。 7. o = new Object()。 17. (x)。 13. public ItemTest(int id) { = id。 5. // insert code here 6. } 7. } What is required at line 5 in class SomeApp to use the process method of BitUtils? A. process(bytes) 。 i3 = i1。 6. public void makeNoise() { (whinny)。 import static .*。 C. import .*。 C. df = ()。表示根據(jù)點(diǎn)( dot)和空格( space)來分割字符串。 12. // insert code here 13. String[] result = (regex)。 } 20. File newDir = new File(newDir)。而 StringBuilder 的 append 方法, (one)。 s1 = (abc) 。 (abc) 。 6. } 7. } What is the result?A. 2 B. 3 C. 4 D. 6 E. 7 F. Compilation fails. Answer: E 很簡單的數(shù)組題。 17. } 18. } Which code, inserted at line 15, allows the class Sprite to pile?A. Foo { public int bar() { return 1。 A 選項(xiàng)是經(jīng)典定義。 a[0]=100。 19. ()。 B. p = () 。 } 17. } What is the result? A. Compilation fails. B. atom granite C. granite granite D. atom granite granite E. An exception is thrown at runtime. F. atom granite atom granite Answer: F 當(dāng)調(diào)用子類的構(gòu)造函數(shù)的時(shí)候,如果沒有顯式調(diào)用父類的構(gòu)造函數(shù),那么父類的默認(rèn)構(gòu)造函數(shù)將被調(diào)用,如果父類沒有默認(rèn)的構(gòu)造函數(shù),編譯器就會警告出錯。實(shí)現(xiàn)了排序,而 reverse 方法是反轉(zhuǎn)集合中的所有元素。 9. (1)。錯誤,雖然 Person對象的 hashCode 方法返回的值都是 420,這僅 僅表明兩個 Person 對象在一個 entry 鏈表中,接下來要調(diào)用 equals 方法,由于 Person 類沒有 equals 方法,所以調(diào)用 Object 的 equals 方法返回對象的存儲地址,很明顯兩個 Person 對象的存儲地址是不同的。 8. } 9. // insert code here 10. } Which method will plete this class? A. public int pareTo(Object o){/*more code here*/ } B. public int pareTo(Score other){/*more code here*/ } C. public int pare(Score s1,Score s2){/*more code here*/ } D. public int pare(Object o1,Object o2){/*more code here*/ } Answer: B 實(shí)現(xiàn) ComparableScore 接口必須實(shí)現(xiàn) parToScore 方法!注意與 Compartor 接口區(qū)分開來, Compartor 接口要求實(shí)現(xiàn) Compare 方法。 16. (subSet)。 i = 20。 TreeSet 是一個有序集,所以其中的元素必須是有序的。 16. TreeSetInteger subs = new TreeSetInteger()。 programmer has an algorithm that requires a that provides an efficient implementation of add(0, object), but does NOT need to support quick random access. What supports these requirements.? A. B. C. D. Answer: D 實(shí)現(xiàn)了 接口,并且需要高效率在首部進(jìn)行插入操作,選項(xiàng)中僅有 LinkedList符合 : 11. // insert code here 12. private N min, max。 13. for ( Iterator iter = ()。 18. } What three changes allow the class to be used with generics and avoid an unchecked warning? (Choose three.) A. Remove line 14. B. Replace line 14 with int i = ()。 20. } 21. } Which two, inserted at line 11, will allow the code to pile? (Choose two. )A. public class MinMax? { The safer , easier way to help you pass any IT exams. B. public class MinMax? extends Number { C. public class MinMaxN extends Object { D. public class MinMaxN extends Number { E. public class MinMax? extends Object { F. public class MinMaxN extends Integer { Answer: D,F 必須有 N 這個泛型,所以從 CDF 中選擇,而 N 需要實(shí)現(xiàn)了 doubleValue 方法, Object 肯定不行,而 Number 和 Integer 都實(shí)現(xiàn)了這個方法。 20. (629)。 3. 4. public class Explorer1 { 5. public static void main(String[] args) { 6. TreeSetInteger treeSet = new TreeSetInteger()。 13. (subSet)。 } 4. public int getWins() { return wins。錯誤, HashMap 中 Person 對象的鍵值不是由 Person 對象決定的,而是程序員給定的鍵,例如(123345, bob),就是把鍵為 123456的 bob對象添加到名為 staff的 HashMap中,因而 HashMap允許添加相同的對象。正確, map 越大,即 bucket 的個數(shù)越多, entry鏈的長度相應(yīng)的來說就越?。?hashcode 和桶個數(shù)取余后的數(shù)一樣的幾率就越?。?。 13. (a)。 } 10. } 11. public class Mountain extends Rock { 12. Mountain() { 13. super(granite )。 : 10. class Line { 11. public class Point { public int x,y。 } 13. } 14. public class Beta extends Alpha { 15. public void foo() { (Bfoo )。 two code fragments correctly create and initialize a static array of int elements? (Choose two.) A. static final int[] a = { 100,200 }。 a[0]=100。 : 10. interface Foo { int bar()。 : 1. class Alligator { 2. public static void main(String[] args) { 3. int []x[] = {{1,2}, {3,4,5}, {6,7,8,9}}。 Which code fragment, inserted at line 24, outputs 123abc 123abc ?A. (abc)。 E. (abc)。 Answer: E 考察 String 類和 StringBuilder 類。 16. File f1 = new File(dir, )。 15. (It is + (j==i) + that j==i.)。 E. String regex = \\.\\s*。 23. // insert code here 24. String s = (date)。 } 5. } and given another class Demo: 1. // insert code here 2. 3. public class Demo { 4. public static void main(String[] args) { 5. (twice(pizza))。 Answer: F 靜態(tài)導(dǎo)入,可以導(dǎo)入類,類中的靜態(tài)方法,靜態(tài)域。而 /home/bob/downloads/*.jar 這種寫法無效,因?yàn)槿绻袃蓚€ jar 包都存在 ,系統(tǒng)不知道是哪一個。 14. i3 = i1。 the Exhibit button. Given the fullyqualified class names: Which graph represents the correct directory structure for a JAR file from which those classes can be used by the piler and JVM? A. Jar A B. Jar B C. Jar C D. Jar D E. Jar E Answer: A classes defined in two different files: 1. package util。 process(bytes) 。 20. } 21. } What is the result?A. Compilation fails. B. An exception is thrown at runtime. C. The attribute id in the ItemTest object remains unchanged. D. The attribute id in the Ite