Map c= new SortedMap();
HashMap c= new HashMap();
HashMap c= new Hashtalole();
SortedMap c= new TreeMap();
ArrayList c= new ArrayList();
MaD c = new LinkedHashMap();
第1题:
1. public interface A { 2. public void doSomething(String thing); 3. } 1. public class AImpl implements A { 2. public void doSomething(String msg) { } 3. } 1. public class B { 2. public A doit() { 3. // more code here 4. } 5. 6. public String execute() { 7. // more code here 8. } 9. } 1. public class C extends B { 2. public AImpl doit() { 3. // more code here 4. } 5. 6. public Object execute() { 7. // more code here 8. } 9. } Which statement is true about the classes and interfaces in the exhibit?()
第2题:
Given a file GrizzlyBear.java: 1. package animals.mammals; 2. 3. public class GrizzlyBear extends Bear { 4. void hunt() { 5. Salmon s = findSalmon(); 6. s.consume(); 7. } 8. } and another file, Salmon.java: 1. package animals.fish; 2. 3. public class Salmon extends Fish { 4. void consume() { /* do stuff */ } 5. } Assume both classes are defined in the correct directories for theft packages, and that the Mammal class correctly defines the findSalmon() method. Which two changes allow this code to compile correctly?()
第3题:
写出分属于下列科的校园植物。 李亚科1.()2.()3.() 苹果亚科1.()2.()3.() 绣线菊亚科1.()2.() 蔷薇亚科() 十字花科1.()2.() 藜科1.()2.() 蓼科() 堇菜科() 卫矛科() 蝶形花科1.()2.()3.()
第4题:
定义Java.Applet程序时,必须有的import语句是()。
第5题:
现有: 1. import java.util.*; 2. class ForInTest { 3.static List list - new ArrayList(): 4. 5.static List getList() { return list; } 6. 7.public static void main (Strincj[] args) { 8.list.add("a"); list.add("b"); list.add("c"); 9. //insert code here 10. System.out.print (o); 11. } 12. } 第9行插入哪一项将输出abc?()
第6题:
1. import java.util.*; 2. public class Example { 3. public static void main(String[] args) { 4. // insert code here 5. set.add(new integer(2)); 6. set.add(new integer(l)); 7. System.out.println(set); 8. } 9. } Which code, inserted at line 4, guarantees that this program will output [1,2]? ()
第7题:
String s = strings.get(0);
Iterator i1 = strings.iterator();
String[] array1 = strings.toArray();
Iterator
String[] array2 = strings.toArray(new String[1]);
Iterator
第8题:
doX();
X.doX();
x.X.doX();
x.X myX = new x.X(); myX.doX();
第9题:
process(bytes);
BitUtils.process(bytes);
app.BitUtils.process(bytes);
util.BitUtils.process(bytes);
import util.BitUtils. *; process(bytes);
SomeApp cannot use the process method in BitUtils.
第10题:
只有s1
只有s3
只有s1和s3
只有s1和s4
第11题:
Line 33 must be called within a try block.
The exception thrown by method1 in class a is not required to be caught.
The method declared on line 31 must be declared to throw a RuntimeException.
On line 5 of class a, the call to method2 of class b does not need to be placed in a try/catch block.
第12题:
one
one three two
one two three
one two three four
four one three two
编译失败
第13题:
1. public class a { 2. public void method1() { 3. try { 4. B b=new b(); 5. b.method2(); 6. // more code here 7. } catch (TestException te) { 8. throw new RuntimeException(te); 9. } 10. } 11. } 1. public class b { 2. public void method2() throws TestException { 3. // more code here 4. } 5. } 1. public class TestException extends Exception { 2. } Given: 31. public void method() { 32. A a=new a(); 33. a.method1(); 34. } Which is true if a TestException is thrown on line 3 of class b?()
第14题:
在单一文件中import、class和package的正确出现顺序是()
第15题:
与page指令<%@ page import= “java.util.*, java.text.* “ %> 等价的是()。
第16题:
现有: import java.util.*; class AddStuff2 { public static void main(String [] args) { TreeSet
第17题:
ClassOne.java: 1. package com.abe.pkg1; 2. public class ClassOne { 3. private char var = ‘a’; 4. char getVar() { return var; } 5. } ClassTest.java: 1. package com.abe.pkg2; 2. import com.abc.pkg1.ClassOne; 3. public class ClassTest extends ClassOne { 4. public static void main(String[] args) { 5. char a = new ClassOne().getVar();6. char b = new ClassTest().getVar(); 7. } 8. } What is the result?()
第18题:
1. import java.util.*; 2. 3. Class FindStuff { 4. public static void main(String [] args) { 5. // insert code here 6. c.put("x", 123); 7. } 8. } 分别插入到第5行,哪三行允许代码编译?()
第19题:
Compilation will fail.
Compilation succeeds and no exceptions are thrown.
Compilation succeeds but an exception is thrown at line 5 in ClassTest.java.
Compilation succeeds but an exception is thrown at line 6 in ClassTest.java.
第20题:
process(bytes);
BitUtils.process(bytes);
util.BitUtils.process(bytes);
SomeApp cannot use methods in BitUtils.
import util.BitUtils.*; process(bytes);
第21题:
<%@ import="“java.util.*" page=""><%@ import="“java.text.*" page=""><%@ import="“java.text.*" page=""><%@ import="“java.util.*" page=""><%@ import="“java.text.*" page=""><%@ import="“java.util.*" page=""><%@ page import= “java.util.* %> <%@ page import= “java.text.* “ %>
<%@ page import= “java.util.*” , import= “java.text.* “ %>
<%@ page import= “java.util.* “ ; %> <%@ page import= “java.text.* “ ; %>
<%@ page import= “java.util.* ; java.text.* “ %>
第22题:
for(char o: list)
for(Object o: getList())
for(Object o: getList();)
for(Object o: o.getList())
第23题:
Map c= new SortedMap();
HashMap c= new HashMap();
HashMap c= new Hashtalole();
SortedMap c= new TreeMap();
ArrayList c= new ArrayList();
MaD c = new LinkedHashMap();
第24题:
import utils.*;
static import utils.*;
import utils.Repetition.*;
static import utils.Repetition. *;
import utils.Repetition.twice();
import static utils.Repetition.twice;
static import utils.Repetition.twice;