What is the output of the following code segment ArrayList <String> sampleArrayList = new ArrayList <String>(); sampleArrayList.add ("One"); sampleArrayList.add ("Two"); sampleArrayList.add (1, "Three"); for(String s : sampleArrayList) { System.out.print(s+" "); }
A. One Two Three
B. One Three Two
C. Three One Two
D. One Three
E. Three Two
F. A compile time error will be generated.
G. A runtime exception will be thrown.
查看答案
中国陆地面积最大的省级行政单位是:( )
A. 内蒙古自治区
B. 新疆维吾尔自治区
C. 海南省
D. 广西壮族自治区
在一起故意伤害案中,县公安局将案件侦查终结移送县人民检察院审查起诉,在审查起诉中,该人民检察院经审查后认为本案的犯罪嫌疑人王某可能被判处无期徒刑。那么,下列做法正确的是:______
A. 将案件退回公安机关
B. 将案件报送上一级检察院,同时通知移送审查起诉的公安机关
C. 将案件直接起诉至中级人民法院
D. 建议公安机关将案卷材料报送上一级公安机关处理
What is the value of the size variable at the completion of this code segment ArrayList <Object> sampleArrayList = new ArrayList <Object>(); sampleArrayList.add(new Object()); sampleArrayList.ensureCapacity(15); sampleArrayList.add(new Object()); int size = sampleArrayList.size();
A. 0
B. 1
C. 2
D. 10
E. 15
F. A compile time error will be generated.
G. A runtime exception will be thrown.
Given the SampleClass, what is the value of currentCount for the instance of object x after the code segment had be executed SampleClass x = new SampleClass(); SampleClass y = new SampleClass(); x.increaseCount(); public class SampleClass { private static int currentCount=(); public SampleClass() { currentCount++; } public void increaseCount() { currentCount++; } }
A. 0
B. 1
C. 2
D. 3
E. Compiler error
F. Runtime error