华为公司招聘java程序员面试题第一部分:选择题QUESTIONNO:11、publicclassTest{publicstaticvoidchangeStr(Stringstr){str="welcome";九塾教育http://rooms9.com}publicstaticvoidmain(String[]args){Stringstr="1234";changeStr(str);System.out.println(str);}}Pleasewritetheoutputresult:QUESTIONNO:21.publicclassTest{2.staticbooleanfoo(charc){3.System.out.print(c);九塾教育http://rooms9.com4.returntrue;5.}6.publicstaticvoidmain(String[]argv){7.inti=0;8.for(foo('A');foo('B')&&(i<2);foo('C')){9.i++;10.foo('D');12.}13.}九塾教育http://rooms9.com14.}Whatistheresult?A.ABDCBDCBB.ABCDABCDC.Compilationfails.D.Anexceptionisthrownatruntime.QUESTIONNO:31.classA{2.protectedintmethod1(inta,intb){return0;}3.}WhichtwoarevalidinaclassthatextendsclassA?(Choosetwo)A.publicintmethod1(inta,intb){return0;}B.privateintmethod1(inta,intb){return0;}C.privateintmethod1(inta,longb){return0;}D.publicshortmethod1(inta,intb){return0;}E.staticprotectedintmethod1(inta,intb){return0;}QUESTIONNO:41.publicclassOuter{2.publicvoidsomeOuterMethod(){3.//Line34.}5.publicclassInner{}6.publicstaticvoidmain(String[]argv){7.Outero=newOuter();8.//Line89.}九塾教育http://rooms9.com10.}WhichinstantiatesaninstanceofInner?A.newInner();//Atline3B.newInner();//Atline8C.newo.Inner();//Atline8D.newOuter.Inner();//Atline8//newOuter().newInner()QUESTIONNO:5WhichmethodisusedbyaservlettoplaceitssessionIDinaURLthatiswrittentotheservlet’sresponseoutputstream?A.TheencodeURLmethodoftheHttpServletRequestinterface.B.TheencodeURLmethodoftheHttpServletResponseinterface.C.TherewriteURLmethodoftheHttpServletRequestinterface.D.TherewriteURLmethodoftheHttpServletResponseinterface.QUESTIONNO:6Whichtwoareequivalent?(Choosetwo)A.B.C.D.E.F.G.QUESTIONNO:7Whichofthefollowingstatementsregardingthelifecycleofasessionbeanarecorrect?1.java.lang.IllegalStateExceptionisthrownifSessionContext.getEJBObject()isinvokedwhenastatefulsessionbeaninstanceispassivated.2.SessionContext.getRollbackOnly()doesnotthrowanexceptionwhenasessionbeanwithbean-managedtransactiondemar...