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

题目内容 (请给出正确答案)

Given:11.publicvoidgenNumbers(){12.ArrayListnumbers=newArrayList();13.for(inti=0;i<10;i++){14.intvalue=i*((int)Math.random());15.IntegerintObj=newInteger(value);16.numbers.add(intObj);17.}18.System.out.println(numbers);19.}WhichlineofcodemarkstheearliestpointthatanobjectreferencedbyintObjbecomesacandidateforgarbagecollection?()

A.Line19

B.TheobjectisNOTacandidateforgarbagecollection.

C.Line17

D.Line16

E.Line18


参考答案

更多 “ Given:11.publicvoidgenNumbers(){12.ArrayListnumbers=newArrayList();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.}WhichlineofcodemarkstheearliestpointthatanobjectreferencedbyintObjbecomesacandidateforgarbagecollection?()A.Line19B.TheobjectisNOTacandidateforgarbagecollection.C.Line17D.Line16E.Line18 ” 相关考题
考题 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.

考题 11.publicvoidgenNumbers(){12.ArrayListnumbers=newArrayList();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.}WhichlineofcodemarkstheearliestpointthatanobjectreferencedbyintObjbecomesacandidateforgarbagecollection?()A.Line16B.Line17C.Line18D.Line19E.TheobjectisNOTacandidateforgarbagecollection.

考题 importjava.util.*;publicclassNameList{privateListnames=newArrayList();publicsynchronizedvoidadd(Stringname){names.add(name);}publicsynchronizedvoidprintAll(){for(inti=0;iSystem.out.print(names.get(i)+);}}publicstaticvoidmain(String[]args){finalNameListsl=newNameList();for(inti=0;i2;i++){newThread(){publicvoidruin(){sl.add(”A”);sl.add(”B”);sl.add(”C”);sl.printAll();}}.start();}}}Whichtwostatementsaretrueifthisclassiscompiledandrun?()

考题 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));

考题 本题的功能是计算l~10之间除了5以外的各个自然数的和。public class javal{public static void main(String[]args){int i=1int sum=0;while(i&lt;=10){if(i= =5){;;};i++;}System.out.println("sum="+sum);}}

考题 以下for语句的表示方法,错误的是A.int i=0; for(i; i<10; i++){}B.for(int i=0, i<10, i++){}C.int i; for(i=0; i<10; i++){}D.for(int i=0; i<10; ){}

考题 定义数组: int number[10]; 以下哪个循环可以遍历整个数组且没有越界操作A.for (int i = 0; i < 10; i++ )B.for (int i = 9; i >= 0; i-- )C.for (int i = 0; i < =10; i++ )D.for (int i = 0; i < = 9; i++ )E.for (int i = 10; i > 0; i-- )F.for (int i =1; i < 10; i++ )G.for (int i =1; i <= 10; i++ )H.for (int i =1; i <= 9; i++ )

考题 3、以下for语句的表示方法,错误的是A.int i=0; for(i; i<10; i++){}B.for(int i=0, i<10, i++){}C.int i; for(i=0; i<10; i++){}D.for(int i=0; i<10; ){}

考题 4、以下哪段代码可以编译:A.int i,k; for (i=0, k=9; i<10 k>0; i++, k--);B.int i; for (i=5, int j=10; j<10; j-- ) ;C.int i,j; for (i=0, j=10; i<10, j>0; i++, j--)D.int i,j; for (i=0; j=10; i<10; i++, j--);