1.publicclassTarget{2.privateinti=0;3.publicintaddOne(){4.return++i;5.}6.}And:1.publicclassClient{2.publicstaticvoidmain(String[]args){3.System.out.println(newTarget().addOne());4.}5.}WhichchangecanyoumaketoTargetwithoutaffectingClient?()
A. Line4ofclassTargetcanbechangedtoreturni++;
B. Line2ofclassTargetcanbechangedtoprivateinti=1;
C. Line3ofclassTargetcanbechangedtoprivateintaddOne(){
D. Line2ofclassTargetcanbechangedtoprivateIntegeri=0;
如果投资者是理性的,那么()。
A. 收益相同时,承担的风险较高
B. 收益相同时,承担的风险较低
C. 风险相同时,预期收益较高
D. 风险相同时,预期收益较低
E. 风险相同时,预期收益相同
packagetest;classTarget{publicStringname=hello”;}Whatcandirectlyaccessandchangethevalueofthevariablename?()
A. anyclass
B. onlytheTargetclass
C. anyclassinthetestpackage
D. anyclassthatextendsTarget
voidwaitForSignal(){Objectobj=newObject();synchronized(Thread.currentThread()){obj.wait();obj.notify();}}Whichistrue?()
A. ThiscodemaythrowanInterruptedException.
B. ThiscodemaythrowanIllegalStateException.
C. ThiscodemaythrowaTimeoutExceptionaftertenminutes.
D. Thiscodewillnotcompileunless“obj.wait()”isreplacedwith“((Thread)obj).wait()”.
E. Reversingtheorderofobj.wait()andobj.notify()maycausethismethodtocompletenormally.
F. Acalltonotify()ornotifyAll()fromanotherthreadmaycausethismethodtocompletenormally.