题目内容 (请给出正确答案)
[主观题]

publicclassXimplementsRunnable(2.privateintx;3.privateinty;4.5.publicstaticvoidmain(Stri

1.publicclassXimplementsRunnable(2.privateintx;3.privateinty;4.5.publicstaticvoidmain(String[]args)6.Xthat=newX();7.(newThread(that)).start();8.(newThread(that)).start();9.)10.11.publicvoidrun()(12.for(;;)(13.x++;14.y++;15.System.out.printIn(x=”+x+,y=”+y);16.)17.)Whatistheresult?()

A.Errorsatlines7and8causecompilationtofail.

B.Theprogramprintspairsofvaluesforxandythatmightnotalwaysbethesameonthesameline(forexample,“x=2,y=1”).

C.Theprogramprintspairsofvaluesforxandythatarealwaysthesameonthesameline(forexample,“x=1,y=1”.Inaddition,eachvalueappearstwice(forexample,“x=1,y=1”followedby“x=1,y=1”).

D.Theprogramprintspairsofvaluesforxandythatarealwaysthesameonthesameline(forexample,“x=1,y=1”.Inaddition,eachvalueappearsonlyforonce(forexample,“x=1,y=1”followedby“x=2,y=2”).

查看答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“publicclassXimplementsRunnable…”相关的问题

第1题

publicclassSyncTest{privateintx;privateinty;publicsynchronizedvoidsetX(inti)(x=1;)publicsynchronizedvoidsetY(inti)(y=1;)publicsynchronizedvoidsetXY(int1)(setX(i);setY(i);)publicsynchronizedBooleancheck()(returnx!=y;)}Underwhichconditionswillcheck()returntruewhencalledfromadifferentclass?

A.Check()canneverreturntrue.

B.Check()canreturntruewhensetXYiscalledbymultiplethreads.

C.Check()canreturntruewhenmultiplethreadscallsetXandsetYseparately.

D.Check()canonlyreturntrueifSyncTestischangedtoallowxandytobesetseparately.

点击查看答案

第2题

publicclassTest{publicstaticvoidleftshift(inti,intj){i<<=j;}publicstaticvoidmain(Stringargs[]){inti=4,j=2;leftshift(i,j);System.out.printIn(i);}}Whatistheresult?()

A.2

B.4

C.8

D.16

E.Thecodewillnotcompile.

点击查看答案

第3题

publicclassFoo{privateintval;publicfoo(intv)(val=v;)}publicstaticvoidmain(String[]args){Fooa=newFoo(10);Foob=newFoo(10);Fooc=a;intd=10;doublee=10.0;}Whichthreelogicalexpressionevaluatetotrue?()

A.(a==c)

B.(d==e)

C.(b==d)

D.(a==b)

E.(b==c)

F.(d==10.0)

点击查看答案

第4题

publicclassTest{publicstaticvoidreplaceJ(stringtext){text.replace(‘j’,‘l’);}publicstaticvoidmain(Stringargs[]){stringtext=newString(java”)replaceJ(text);system.out.printIn(text);}}Whatistheresult?()

A.Theprogramprints“lava”

B.Theprogramprints“java”

C.Anerroratline7causescompilationtofail.

D.Compilationsucceedsbuttheprogramthrowsanexception.

点击查看答案
热门考试 全部 >
相关试卷 全部 >
账号:
你好,尊敬的上学吧用户
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
谢谢您的反馈

您认为本题答案有误,我们将认真、仔细核查,
如果您知道正确答案,欢迎您来纠错

警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

微信搜一搜
上学吧
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反上学吧购买须知被冻结。您可在“上学吧”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
上学吧
点击打开微信