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”).

时间:2023-09-10 12:57:44

相似题目