Given: Which code, inserted at line 16, will cause a java.lang.ClassCastException?()
A.Alpha a = x; B.Foo f = (Delta)x; C.Foo f = (Alpha)x; D.Beta b = (Beta)(Alpha)x;
单项选择题Given: What is the result?()
A.2 B.3 C.12 D.23
单项选择题Click the Exhibit button. Which code, inserted at line 14, will allow this class to correctly serialize and deserialize?()
A.s.defaultReadObject(); B.this = s.defaultReadObject(); C.y = s.readInt(); x = s.readInt(); D.x = s.readInt(); y = s.readInt();
单项选择题Given: 22.StringBuilder sb1 = new StringBuilder( 123 ); 23.String s1 = 123 ; 24. insert code here 25.System.out.println(sb1 + + s1); Which code fragment, inserted at line 24, outputs 123abc 123abc ?()
A.sb1.append("abc"); s1.append("abc"); B.sb1.append("abc"); s1.concat("abc"); C.sb1.concat("abc"); s1.append("abc"); D.sb1.concat("abc"); s1.concat("abc"); E.sb1.append("abc"); s1 = s1.concat("abc");
单项选择题Given: Which method will complete this class?()
A.public int compareTo(Object o){/*more code here*/} B.public int compareTo(Score other){/*more code here*/} C.public int compare(Score s1,Score s2){/*more code here*/} D.public int compare(Object o1,Object o2){/*more code here*/}
单项选择题Given: What is the result?()
A.test end B.Compilation fails. C.test runtime end D.test exception end E.A Throwable is thrown by main at runtime.