java工程师考试

java工程师考试

ID:41153982

大小:26.00 KB

页数:13页

时间:2019-08-17

java工程师考试_第1页
java工程师考试_第2页
java工程师考试_第3页
java工程师考试_第4页
java工程师考试_第5页
资源描述:

《java工程师考试》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、第一题:(过程可以写在后面)学校的毕业话剧演出由四个小美女来出演小红帽、美羊羊、女巫和公主的角色。没人在排练时的角色与演出时的角色不同。排练时出演小红帽的人会撒谎,通过如下消息,请判断四人在演出和排练时分别出演什么角色。梅:“排练时,兰的角色是演出时竹的角色。”兰:“菊排练时扮演的是美羊羊。”竹:“演出时我演公主。”菊:“兰演出时扮演的是美羊羊。”第二题:解数独题(数独是九宫格(即3格宽x3格高))正方形状,每一格又细分为一个九宫格,在没一个小九宫格中,分别填上1~9个数字,让每一个大九宫格没一列,没一行的数字都不重复。817469483385275

2、6966511831、Whichlinecontainsaconstructorinthisclassdefinition?publicclassCounter{//(1)intcurrent,step;publicCounter(intstartVaue,intstepValue){//(2)set(startValue);setStepValue(steValue);}publicintget(){returncurrent;}//(3)publicvoidset(intvalue){current==value;}//(4)publicvoid

3、setStepValue(intstepValue){step==stepValue;}//(5)}1)Codemarkedwith(1)isaconstructor2)Codemarkedwith(2)isaconstructor3)Codemarkedwith(3)isaconstructor4)Codemarkedwith(4)isaconstructor5)Codemarkedwith(5)isaconstructor2、Aninstancemember...1)isalsocalledastaticmember2)isalwaysavari

4、able3)isneveramethod4)belongstoasingleinstance,nottotheclassasawhole5)alwaysrepresentsanoperation3、Giventhefollowingclass,whichstatementscanbeinsertedatpositionIwithoutcausingthecodetofailcompilation?publicclassQ6db8{inta;intb=0;staticintc;publicvoidm(){intd;inte=0;//Position1}

5、}1)a++2)b++3)c++4)d++5)e++7、Whatiswrongwiththefollowingcode?ClassMyExceptionextendsException{}Publicclassqb4ab{Publicvoidfoo(){Try{Bar();}finally{Baz();}catch(MyExceptione){}Publicvoidbar()throwsMyException{ThrownewException();}Publicvoidbaz()throwsRuntimeException{ThrownewRunt

6、imeException();}}4、)Sincethemethodfoo()doesnotcatchtheexceptiongeneratedbythemethodbaz(),itmustdeclaretheRuntimeExceptioninitsthrowsclause.4、)Athetryblockcannotbefollowedbybothacatchandafinallyblock.5、)Anemptycatchblockisnotallowed.6、)Acatchblockcannotfollowafinallyblock.7、)Afi

7、nallyblockmustalwaysfollowoneormorecatchblocks.5、WhatwillhappenwhenyouattempttocompileandrunthefollowingprogrambypassingtheTestclasstotheJavainterpreter?ClassTest{Publicstaticvoidmain{System.out.print(“hello”);}}Selecttheonerightanswer.6.theprogramdoesnotcompilebecausemain()isn

8、otdefinedcorrectly.7.Theprogramcompilesbutwhenyoutryto

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。