11.public void genNumbers(){ 12.ArrayList numbers=new ArrayL

题目
单选题
11.public void genNumbers(){ 12.ArrayList numbers=new ArrayList(); 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.} Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbagec ollection?()
A

Line16

B

Line17

C

Line18

D

Line19

E

The object is NOT a candidate for garbage collection.

参考答案和解析
正确答案: C
解析: 暂无解析
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

下面程序的运算结果是()。includeusing namespace std;class A{public:virtual void f

下面程序的运算结果是( )。 #include<iostream> using namespace std; class A { public: virtual void fun()=0; }; class B:public A } public: void fun() {cout<<"new file"<<" ";} }; class C:public A { public: void fun() { cout<<"open file"<<" ";} }; void main() { A a, * p; B b;C c; p=&c; p->fun(); p=&b; }

A.new file open file

B.new file new file

C.编译出错

D.open file new file


正确答案:C
解析:语句Aa,*p;用抽象类说明了一个对象,这是不允许的。若把其改为A*p;则程序运行结果为D。

第2题:

请写出下面的输出:

class B

{

public:

virtual void Print(void)

{

printf(“B::Print\n”);

}

virtual void Reprint(void)

{

printf(“B:Reprint\n”);

}

void Algo(void)

{

Print();

Reprint();

}

};

class D : public B

{

public:

virtual void Print(void)

{

printf(“D::Print\n”);

}

};

void main()

{

B *p = new D();

p->Print();

p->Algo();

}


正确答案:
 

第3题:

为使下列代码正常运行,应该在下划线处填入的选项是

int〔〕numbers=new int[n];

for(Int i=0;i <numbers.____;i++)

numbers[i]=i+1;

A.size

B.length

C.dimension

D.measurement


正确答案:C

第4题:

11.public void genNumbers(){ 12.ArrayList numbers=new ArrayList(); 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.} Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbagec ollection?()

  • A、Line16
  • B、Line17
  • C、Line18
  • D、Line19
  • E、The object is NOT a candidate for garbage collection.

正确答案:D

第5题:

下面程序的结果是 ______。includeclass A{ public:virtual voidfun()=0{};};class

下面程序的结果是 ______。 #include<iostream.h> class A{ public: virtual void fun()=0{}; }; class B:public A{ public: void fun () {cout<< "new file" ;} }; class C: public A{ public: void fun (){cout<<"open file"<< " " } }; class D: public A{ public: void fun () {cout<< "save file\n" ;} }; void main() { A a,*p; B b; C c; D d; p=&c; p->fun (); p=&b; p->fun (); p=&d; p->fun(); }

A.new file open file save file

B.new file new file new file

C.编译出错

D.open file new file save file


正确答案:C

第6题:

写出程序的输出结果:

public class A

{

public virtual void Fun1(int i)

{

Console.WriteLine(i);

}

public void Fun2(A a)

{

a.Fun1(1);

Fun1(5);

}

}

public class B : A

{

public override void Fun1(int i)

{

base.Fun1 (i + 1);

}

public static void Main()

{

B b = new B();

A a = new A();

a.Fun2(b);

b.Fun2(a);

}

}


正确答案:
 

第7题:

阅读下面程序 public class Test implements Runnable { public static void main(String[] args) { ______ t.start(); } public void run() { System.out.println("Hello!"); } } 程序中下画线处应填入的正确选项是

A.Test t=new Test();

B.Thread t=new Thread();

C.Thread t=new Thread(new Test());

D.Test t=new Thread();


正确答案:C

第8题:

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.Line16

B.Line17

C.Line18

D.Line19

E.The object is NOT a candidate for garbage collection.


参考答案:D

第9题:

class One {  public One() { System.out.print(1); }  }  class Two extends One {  public Two() { System.out.print(2); }  }  class Three extends Two {  public Three() { System.out.print(3); }  }  public class Numbers{  public static void main( String[] argv) { new Three(); }  }  What is the result when this code is executed?() 

  • A、 1
  • B、 3
  • C、 123
  • D、 321
  • E、 The code rims with no output.

正确答案:C

第10题:

class MyThread extends Thread {  public void run() { System.out.println(“AAA”); }  public void run(Runnable r) { System.out.println(“BBB”); }  public static void main(String[] args) {  new Thread(new MyThread()).start();  }  }   What is the result?()  

  • A、 AAA
  • B、 BBB
  • C、 Compilation fails.
  • D、 The code runs with no output.

正确答案:A

更多相关问题