欢迎来到天天文库
浏览记录
ID:44489647
大小:69.66 KB
页数:7页
时间:2019-10-22
《搜狐公司JAVA高级工程师笔试题》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、1:Aclassdesignrequiresthatamembervariableshouldbeaccessibleonlybysamepackage,whichmodiferwordshouldbeused?A.protectedB.publicC.nomochferD.private2:Whatwillhappenwhenyouattempttocompileandrunthefollowingcode?publicclassStatic{static{intx=5;}staticintx,y;publicstaticvoi
2、dmain(Stringargs[]){X-;myMethod();System.out.println(x+y+++x);}publicstaticvoidmyMethod()y=x+++++x;Choices:A.prints:2B.prints:3C.prints:7D.prints:83:Whatwillbetheresultofexecutingthefollowingcode?publicstaticvoidmain(Stringargs[]){chardigit='a';for(inti=0;i<10;i++){sw
3、itch(digit){case'x':{intj=0;System.out.println(j);}default:{intj=100;System.out.println(j);}}}inti=j;System.out.println(i);}Choices:A.100willbeprinted11times.B.Thecodewillnotcompilebecausethevariableicannotbedeclaredtwicewithinthemain()method・C.Thecodewillnotcompilebe
4、causethevariablejcannotbedeclaredtwicewithintheswitchstatement.A.Noneofthese.4:WhichfragmentsarenotcorrectinJavasourcefile?A.packagetestpackage;publicclassTest{//dosomething...}B.importjava.io.*;packagetestpackage;publicclassTest{//dosomething...}C.importjava.io.*;cla
5、ssPerson{〃dosomething...}publicclassTest{//dosomething...}D.importjava.io.*;importjava.awt.*;publicclassTest{//dosomething・..}/*第一行*/下述程序代码中有语法错误的行是()ointizia[10]zib[10];/*第一行*/for(i=0;i<=9;i++)/*第2行*/ib=ia;厂第4行*/A.第1行B.第2行C.第3行D.第4行6:Whichofthefollowingstatementsaret
6、rue?A.TheautomaticgarbagecollectionoftheJVMpreventsprogramsfromeverrunningoutofmemoryB.AprogramcansuggestthatgarbagecollectionbeperformedandforceitC.GarbagecollectionisplatformindependentD.Anobjectbecomeseligibleforgarbagecollectionwhenallreferencesdenotingitaresetton
7、ull.7:SelectvalididentifierofJava:A.%passwdB.3d_gameC.$chargeD.this8:Math.round(-11.5)等於多少?A.-llB.-12A.-11.5B.none9:Whatresultsfromattemptingtocompileandrunthefollowingcode?publicclassTernarypublicstaticvoidmainfStringargs[]){inta=5;System.out.println(nValueis-"+((a<5
8、)?9.9:9));}}Choices:A.prints:Valueis-9B.CompilationerrorC・prints:Valueis・5D.Noneofthese10:Whichisthemain()methodreturnofaapp
此文档下载收益归作者所有