网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
多选题
ArraryList a = new ArrayList();  a.add(“Alpha”);  a.add(“Bravo”):  a.add(“Charlie”);  a.add(“Delta”);  Iterator iter = a.iterator(); Which two, added at line 17, print the names in the ArrayList in alphabetical order?()
A

for (int i=0; i< a.size(); i++)     System.out.println(a.get(i)));

B

for (int i=0; i< a.size(); i++)     System.out.println(a[i]);

C

while( iter.hasNext() )     System.out.println(iter.next()) ;

D

for (int i=0, i< a.size(); i++)    System.out.println(iter[i]);

E

for (int i=0; i< a.size(); i++)    System.out.println(iter.get(i));


参考答案

参考解析
解析: 暂无解析
更多 “多选题ArraryList a = new ArrayList();  a.add(“Alpha”);  a.add(“Bravo”):  a.add(“Charlie”);  a.add(“Delta”);  Iterator iter = a.iterator(); Which two, added at line 17, print the names in the ArrayList in alphabetical order?()Afor (int i=0; i a.size(); i++)  System.out.println(a.get(i)));Bfor (int i=0; i a.size(); i++)  System.out.println(a[i]);Cwhile( iter.hasNext() )  System.out.println(iter.next()) ;Dfor (int i=0, i a.size(); i++)  System.out.println(iter[i]);Efor (int i=0; i a.size(); i++)  System.out.println(iter.get(i));” 相关考题
考题 A lawyer’s income is usually very high, ________ more than one million yuan a year. A.add up toB.added up toC.amounted toD.amounting to

考题 向容器添加新构件的方法是( )。A.add()B.insert()C.hill()D.set()

考题 The carrick bend is used to ______.A.add strength to a weak spot in a lineB.join two hawsersC.be a stopper to transfer a line under strainD.join lines of different sizes

考题 11.public void genNumbers(){12.ArrayList numbers=new ArrayList();13.for(inti=0;i14.intvalue=i*((int)Math.random());15.IntegerintObj=newInteger(value);16.numbers.add(intObj);17.}18.System.out.println(numbers);19.}Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbagec ollection?()A.Line16B.Line17C.Line18D.Line19E.The object is NOT a candidate for garbage collection.

考题 ArraryLista=newArrayList();a.add(Alpha”);a.add(Bravo”):a.add(Charlie”);a.add(Delta”);Iteratoriter=a.iterator();Whichtwo,addedatline17,printthenamesintheArrayListinalphabeticalorder?() A.for(inti=0;ia.size();i++) System.out.println(a.get(i)));B.for(inti=0;ia.size();i++) System.out.println(a[i]);C.while(iter.hasNext()) System.out.println(iter.next());D.for(inti=0,ia.size();i++) System.out.println(iter[i]);E.for(inti=0;ia.size();i++) System.out.println(iter.get(i));

考题 Given two files, GrizzlyBear.java and Salmon.java:If both classes are in the correct directories for their packages, and the Mammal class correctly defines the findSalmon() method, which change allows this code to compile?()A.add import animals.mammals.*; at line 2 in Salmon.javaB.add import animals.fish.*; at line 2 in GrizzlyBear.javaC.add import animals.fish.Salmon.*; at line 2 in GrizzlyBear.javaD.add import animals.mammals.GrizzlyBear.*; at line 2 in Salmon.java

考题 函数模板:template T add(T x,T y){return x+y;}下列对add函数的调用不正确的是A.add<> 函数模板:template<class T> T add(T x,T y){return x+y;} 下列对add函数的调用不正确的是A.add<>(1,2)B.add<int>(1,2)C.add(1,0,2)D.add(1.0,2.0)

考题 函数模板:templateT add(T x, T y) {return x+y;}下列对add函数的调用不正确的是A.add 函数模板:template<class T> T add(T x, T y) {return x+y;} 下列对add函数的调用不正确的是A.add<>(1,2)B.add<int>(1,2)C.add(1.0,2)D.add(1.0,2.0)

考题 通常我们使用( )方法来为一个部件注册事件监听器。A.add×××ListenerB.×××ListenerSX 通常我们使用( )方法来为一个部件注册事件监听器。A.add×××ListenerB.×××ListenerC.Listener×××D.×××Listeneradd

考题 下列指令中,不影响标志位的是______。A.ADD AX,BXB.ROL AL,1C.JNC LEND.INT n

考题 若有以下程序:include using namespace std;class myClass{private: int var;public: 若有以下程序: #include <iostream> using namespace std; class myClass { private: int var; public: myClass(int i) { var=i; } void add() { s+=var; } static int s; void display() { cout<<s<<end1; } }; int myClass::s=0; int main ( ) { myClass a(1),b(2),c(3); a.add(); b.add(); c.dislay(); return O; } 程序执行后的输出结果是( )。A.1B.4C.3D.7

考题 WhichutilityallowsatechniciantoseethestatusofsystemresourcessuchasIRQsonaWindows2000computer?() A.Add/RemoveHardwareB.WINNT32C.SYSEDITD.DeviceManager

考题 函数模板:templateT add(Tx,Ty){returnx+y;}下列对add函数的调用不正确的是()。A.add<>( 函数模板:template<class T> T add(Tx,Ty){returnx+y;} 下列对add函数的调用不正确的是( )。A.add<>(1,2)B.=add<int> (1,2)C.add(1.0,2)D.add(1.0,2.0)

考题 下列方法中可以用于往HashSet集合中添加元素的是() A.add(E e)B.contains(Object o)C.clear()D.iterator()

考题 被用来向容器中添加构件的方法是( )。A.add()B.update()C.repaint()D.getFont()

考题 11.public void genNumbers(){ 12.ArrayList numbers=new ArrayList(); 13.for(inti=0;i10;i++){ 14.intvalue=i*((int)Math.random()); 15.IntegerintObj=newInteger(value); 16.numbers.add(intObj); 17.} 18.System.out.println(numbers); 19.} Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbagec ollection?()A、Line16B、Line17C、Line18D、Line19E、The object is NOT a candidate for garbage collection.

考题 ArraryList a = new ArrayList();  a.add(“Alpha”);  a.add(“Bravo”):  a.add(“Charlie”);  a.add(“Delta”);  Iterator iter = a.iterator(); Which two, added at line 17, print the names in the ArrayList in alphabetical order?()A、 for (int i=0; i a.size(); i++)  System.out.println(a.get(i)));B、 for (int i=0; i a.size(); i++)  System.out.println(a[i]);C、 while( iter.hasNext() )  System.out.println(iter.next()) ;D、 for (int i=0, i a.size(); i++)  System.out.println(iter[i]);E、 for (int i=0; i a.size(); i++)  System.out.println(iter.get(i));

考题 You need to create a JSP that generates some JavaScript code to populate an array of strings used on theclient-side. Which JSP code snippet will create this array?()A、MY_ARRAY = new Array();% for ( int i = 0; i  serverArray.length; i++ ) { MY_ARRAY[%= i %] = ’%= serverArray[i] %’;} %B、MY_ARRAY = new Array();. % for ( int i = 0; i  serverArray.length; i++ ) { . MY_ARRAY[${i}] = ’${serverArray[i]}’;. } %C、MY_ARRAY = new Array();. % for ( int i = 0; i  serverArray.length; i++ ) { % . MY_ARRAY[%= i %] = ’%= serverArray[i] %’;. % } %D、MY_ARRAY = new Array();% for ( int i = 0; i  serverArray.length; i++ ) { % . MY_ARRAY[${i}] = ’${serverArray[i]}’;. % } %

考题 11. public void genNumbers() {  12. ArrayList numbers = new ArrayList();  13. for (int i=0; i10; i++) {  14. int value = i * ((int) Math.random());  15. Integer intObj = new Integer(value);  16. numbers.add(intObj);  17. }  18. System.out.println(numbers);  19. }  Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbage collection?() A、 Line 16B、 Line 17C、 Line 18D、 Line 19E、 The object is NOT a candidate for garbage collection.

考题 import java.util.*;  public class NameList {  private List names = new ArrayList();  public synchronized void add(String name) { names.add(name); }  public synchronized void printAll() {  for (int i = 0; i System.out.print(names.get(i) +“ “); }  }  public static void main(String[] args) {  final NameList sl = new NameList();  for(int i=0;i2;i++) {  new Thread() {  public void ruin() {  sl.add(”A”);  sl.add(”B”);  sl.add(”C”);  sl.printAll();  }  }.start();  }  }  }  Which two statements are true if this class is compiled and run?() A、 An exception may be thrown at runtime.B、 The code may run with no output, without exiting.C、The code may rum with output “A B A B C C “, then exit.D、The code may ruin with output “A A A B C A B C C “, then exit.E、 The code may rum with output “A B C A B C A B C “, then exit.F、The code may ruin with output “A B C A A B C A B C “, then exit.

考题 1. import java.util.*;  2. public class Test {  3. public static void main(String[] args) {  4. List strings = new ArrayList();  5. // insert code here  6. }  7. }  Which four, inserted at line 5, will allow compilation to succeed?()A、 String s = strings.get(0);B、 Iterator i1 = strings.iterator();C、 String[] array1 = strings.toArray();D、 Iterator i2 = strings.iterator();E、 String[] array2 = strings.toArray(new String[1]);F、 Iterator i3 = strings.iterator();

考题 public class TestFive {  private int x;  public void foo() {  int current = x;  x = current + 1;  }  public void go() {  for(int i=0;i5;i++) {  new Thread() {  public void run() {  foo();  System.out.print(x + “, “);  } }.start();  }}}  Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ?()A、 Move the line 12 print statement into the foo() method.B、 Change line 7 to public synchronized void go() {.C、 Change the variable declaration on line 3 to private volatile int x;.D、 Wrap the code inside the foo() method with a synchronized( this ) block.E、 Wrap the for loop code inside the go() method with a synchronized block synchronized(this) { // for loop code here }.

考题 多选题1. import java.util.*;  2. public class Test {  3. public static void main(String[] args) {  4. List strings = new ArrayList();  5. // insert code here  6. }  7. }  Which four, inserted at line 5, will allow compilation to succeed?()AString s = strings.get(0);BIterator i1 = strings.iterator();CString[] array1 = strings.toArray();DIterator i2 = strings.iterator();EString[] array2 = strings.toArray(new String[1]);FIterator i3 = strings.iterator();

考题 多选题import java.util.*;  public class NameList {  private List names = new ArrayList();  public synchronized void add(String name) { names.add(name); }  public synchronized void printAll() {  for (int i = 0; i System.out.print(names.get(i) +“ “); }  }  public static void main(String[] args) {  final NameList sl = new NameList();  for(int i=0;iAAn exception may be thrown at runtime.BThe code may run with no output, without exiting.CThe code may rum with output “A B A B C C “, then exit.DThe code may ruin with output “A A A B C A B C C “, then exit.EThe code may rum with output “A B C A B C A B C “, then exit.FThe code may ruin with output “A B C A A B C A B C “, then exit.

考题 多选题public class TestFive {  private int x;  public void foo() {  int current = x;  x = current + 1;  }  public void go() {  for(int i=0;i5;i++) {  new Thread() {  public void run() {  foo();  System.out.print(x + “, “);  } }.start();  }}}  Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ?()AMove the line 12 print statement into the foo() method.BChange line 7 to public synchronized void go() {.CChange the variable declaration on line 3 to private volatile int x;.DWrap the code inside the foo() method with a synchronized( this ) block.EWrap the for loop code inside the go() method with a synchronized block synchronized(this) { // for loop code here }.

考题 多选题Given a pre-generics implementation of a method: What three changes allow the class to be used with generics and avoid an unchecked warning?()ARemove line 14.BReplace line 14 with "int i = iter.next();".CReplace line 13 with "for (int i : intList) {".DReplace line 13 with "for (Iterator iter : intList) {".EReplace the method declaration with "sum(List  intList)".

考题 单选题11.public void genNumbers(){ 12.ArrayList numbers=new ArrayList(); 13.for(inti=0;i10;i++){ 14.intvalue=i*((int)Math.random()); 15.IntegerintObj=newInteger(value); 16.numbers.add(intObj); 17.} 18.System.out.println(numbers); 19.} Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbagec ollection?()A Line16B Line17C Line18D Line19E The object is NOT a candidate for garbage collection.