网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
classA{}classAlpha{privateAmyA=newA();voiddolt(Aa){a=null;}voidtryIt(){dolt(myA);}}Whichtwostatementsarecorrect?()
A.TherearenoinstancedofAthatwillbecomeeligibleforgarbagecollection.
B.ExplicitlysettingmyAtonullmarksthatinstancetobeeligibleforgarbagecollection.
C.AnycallontryIt()causestheprivateinstanceofAtobemarkedforgarbagecollection.
D.PrivateinstancesofAbecomeeligibleforgarbagecollectionwheninstancesofAlphabecomeeligibleforgarbagecollection.
参考答案
更多 “ classA{}classAlpha{privateAmyA=newA();voiddolt(Aa){a=null;}voidtryIt(){dolt(myA);}}Whichtwostatementsarecorrect?() A.TherearenoinstancedofAthatwillbecomeeligibleforgarbagecollection.B.ExplicitlysettingmyAtonullmarksthatinstancetobeeligibleforgarbagecollection.C.AnycallontryIt()causestheprivateinstanceofAtobemarkedforgarbagecollection.D.PrivateinstancesofAbecomeeligibleforgarbagecollectionwheninstancesofAlphabecomeeligibleforgarbagecollection. ” 相关考题
考题
ClassTestException1.publicclassTestExceptionextendsException{2.}Classa:1.publicclassa{2.3.publicStringsayHello(Stringname)throwsTestException{4.5.if(name==null){6.thrownewTestException();7.}8.9.returnHello+name;10.}11.12.}Aprogrammerwantstousethiscodeinanapplication:45.Aa=newA();46.System.out.println(a.sayHello(”John”));Whichtwoaretrue?()A.Classawillnotcompile.B.Line46canthrowtheuncheckedexceptionTestException.C.Line45canthrowtheuncheckedexceptionTestException.D.Line46willcompileiftheenclosingmethodthrowsaTestException.E.Line46willcompileifenclosedinatryblock,whereTestExceptioniscaught.
考题
voidstart(){13.Aa=newA();14.Bb=newB();15.a.s(b);16.b=null;17.a=null;18.System.out.println(startcompleted”);19.}WhenistheBobject,createdinline14,eligibleforgarbagecollection?()
A.Afterline16.B.Afterline17.C.Afterline18(whenthemethodsends).D.Thereisnowaytobeabsolutelycertain.E.TheobjectisNOTeligibleforgarbagecollection.
考题
class A{void P1(){cout"A111"};void P2(){cout"A222"};};class B:public A{void P1(){cout"B111"};virtual void P2(){cout"B222"};}..........A*cl=NULL;cl=new A;A-P1();A-P2();delete cl;cl=NULL;cl=new B;A-P1();A-P2();delete cl;cl=NULL;..........写出运行结果;
考题
下列程序的运行结果为______。 class A { int b=0; } public class ex35 public static void main(String args[]) { ex35 t=new ex35(); t.method(); } void method() { A A1=new A(); A A2=new A(); A1,b=A2.b=12; boolean b=A1.equals(A2); Syatem.out.println(b); } }A.trueB.falseC.0D.1
考题
下面程序运行后的输出结果为() class A{ public int y=6; void showy(){ System.out.println("y="+y); } } class testA{ public static void main(String aaa []){ A a1 = new A(); A b1 = new A(); a1.y++; b1.showy(); } } 输出结果选择:A.y=6B.程序运行出错C.y=8D.y=7
考题
B是A的子类,下列语句正确的是A.A a=new B();B.B b=new A();C.A a=new A();D.B b=(B)new A();
热门标签
最新试卷