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

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

1.public class GC{2.private Objec to;3.private void doSomethingElse(Object obj){o=obj;}4.public void doSomething(){5.Object o=new Object();6.doSomethingElse(o);7.o=new Object();8.doSomethingElse(null);9.o=null;10.}11.}When the doSomething method is called,after which line does the Object created in line 5 become available for garbage collection?()

A.Line5

B.Line6

C.Line7

D.Line8

E.Line9

F.Line10


参考答案

更多 “ 1.public class GC{2.private Objec to;3.private void doSomethingElse(Object obj){o=obj;}4.public void doSomething(){5.Object o=new Object();6.doSomethingElse(o);7.o=new Object();8.doSomethingElse(null);9.o=null;10.}11.}When the doSomething method is called,after which line does the Object created in line 5 become available for garbage collection?()A.Line5B.Line6C.Line7D.Line8E.Line9F.Line10 ” 相关考题
考题 以下程序的执行结果是【】。 include using namespace std; class base { public: virmal 以下程序的执行结果是【 】。include<iostream>using namespace std;class base{public:virmal void who(){cout<<"Base Class"<<endl;)};class Derivedl:public Base{public:virtual void who(){cout<<"Derivedl Class"<<endl;}};class derived2:public Base{public:virtual void who(){cout<<"Derived2 Class"<<endl;)};int main(int argc,char*argv[]){base obj1,*P;deliVedl obj2;derived2 obj3;p=obj1; p->who();p=obj2; p->who();p=obj3; p->who();return 0;}

考题 以下程序的执行结果是______。 include class base { public: virtual void who(){c 以下程序的执行结果是______。include<iostream.h>class base{public:virtual void who(){cout<<"base class"<<endl:}};class derrvel:public base{public:void who(){cout<<"derivel class"<<endl:}};class derive2;public base{public:void who() {cout<<"derive2 class"<<endl;}};void main(){base obj1,*P;derive1 obj2;derive2 obj3:p=obj1;p->who();p=obj2:p->who();p=obj3;p->who();}

考题 设有以下定义和程序:includeclass A1{public: void show1(){cout 设有以下定义和程序:#include<iostream.h>class A1{public: void show1() { cout<<"class A1"<<endl; } };class A2 : public A1{public: void show2() { cout<<"class A2"<<end1 }};class A3 : protected A2{public: void show3() { cout<<"class A1"<<endl; }};void main(){ A1 obj1; A2 obj2; A3 obj3;} 则以下不合语法的调用语句是A.obj1. showl();B.obj2. showl();C.obj3. showl();D.obj2. show2();

考题 有以下程序:include using namespace std;class Base{public:Base(){}virtual void w 有以下程序: #include <iostream> using namespace std; class Base { public: Base(){} virtual void who() { cout<<"Base Class"<<end1; } ~Base(){} }; class Derivel : public Base { public: void who() { cout<<"Derivel Class"<<end1; } }; class Derive2 : public Base { public: void who () { cout<<"Derive2 Class"<<end1; } }; int main () { Base *p; Derivel obj1; Derive2 obj2; p=obj1; p=obj2; p->who ( ); return 0; } 执行程序后的输出结果是( )。A.Base ClassB.Derivel ClassC.Derive2 ClassD.程序编译时出错

考题 设有以下定义和程序:includeclassA1{public: void showl() { cout 设有以下定义和程序: #include <iostream.h> class A1 { public: void showl() { cout<<"class A1"<<end1; } }; Class A2 : public A1 { public: void show2() { cout<<"Class A2"<<end1; } }; Class A3 : protected A2 { public: void show3() { cout<<”Class A土”<<end1; } }; void main() { A1 obj1; A2 obj2; A3 obj3; } 则以下不合语法的调用语句是( )。A.obj1.show1();B.obj2.show1();C.obj3.show1();D.obj2.show2();

考题 下列程序编译错误,是由于划线处缺少某个语句,该语句是______。 include class A { pr 下列程序编译错误,是由于划线处缺少某个语句,该语句是______。include<iostream.h>class A{private:int numl;public:A( ):numl(0){}A(int i):numl(i){}};class B{private:int num2;public:B( ):num2(0){}B(int i):num2(i){}int my_math(A obj1, B obj2);};int B::my_math(A obj1,B obj2){return(obj1.numl+obj2.num2);}void main(void){A objl(4);B obj,obj2(5);cout<<"obj1+obj2:"<<obj.my_math(obj1,obj2);}

考题 对于下列程序段,没有二义性的表达式是() class A {public: int f(); }; class B {public: int g(); int f(); }; class C:public A,public B {public : int g(); h(); }; C obj;A.obj.f()B.obj.A::g()C.obj.B::f()D.obj.B::h()

考题 3、对于下列程序段,没有二义性的表达式是() class A {public: int f(); }; class B {public: int g(); int f(); }; class C:public A,public B {public : int g(); h(); }; C obj;A.obj.f()B.obj.A::g()C.obj.B::f()D.obj.B::h()

考题 type(obj) 函数为返回参数obj的类型,eval(obj)函数负责将obj两侧的一对单/双引号去除,则type(eval('"45"'))的结果为A.45B.<class 'int'>C.<class 'str'>D.None