A.Theattributefooisplacedintheapplication
B.AServletContextListenerregisteredforthatservletisnotified
C.AServletAttributeListenerregisteredforthatservletisnotified
D.AnHttpSessionAttributeListenerregisteredforthatservletisnotified
第1题:
GiventheJSPcode:<%request.setAttribute("foo","bar");%>andtheClassictaghandlercode:5.publicintdoStartTag()throwsJspException{6.//insertcodehere7.//returnint8.}Assumetherearenoother"foo"attributesinthewebapplication.WhichinvocationonthepageContextobject,insertedatline6,assigns"bar"tothevariablex?()
A.Stringx=(String)pageContext.getAttribute("foo")
B.Stringx=(String)pageContext.getRequestScope("foo")
C.ItisNOTpossibletoaccessthepageContextobjectfromwithindoStartTag
D.Stringx=(String)pageContext.getRequest().getAttribute("foo")
E.Stringx=(String)pageContext.getAttribute("foo",PageContext.ANY_SCOPE)
第2题:
publicclassBase{publicstaticfinalStringFOO=foo”;publicstaticvoidmain(String[]args){Baseb=newBase();Subs=newSub();System.out.print(Base.FOO);System.out.print(Sub.FOO);System.out.print(b.FOO);System.out.print(s.FOO);System.out.print(((Base)s).FOO);}}classSubextendsBase{publicstaticfinalStringFOO=bar;}Whatistheresult?()
A.foofoofoofoofoo
B.foobarfoobarbar
C.foobarfoofoofoo
D.foobarfoobarfoo
E.barbarbarbarbar
F.foofoofoobarbar
G.foofoofoobarfoo
第3题:
A.ABDCBDCB
B.ABCDABCD
C.Compilationfails.
D.Anexceptionisthrownatruntime.
第4题:
publicclassFoo{publicinta;publicFoo(){a=3;}publicvoidaddFive(){a+=5;}}and:publicclassBarextendsFoo{publicinta;publicBar(){a=8;}publicvoidaddFive(){this.a+=5;}}invokedwith:Foofoo=newBar();foo.addFive();System.out.println(”Value:+foo.a);Whatistheresult?()
A.Value:3
B.Value:8
C.Value:13
D.Compilationfails.
E.Thecoderunswithnooutput.
F.Anexceptionisthrownatruntime.
第5题:
A.Bazhasthevalueof0
B.Bazhasthevalueof1
C.Bazhasthevalueof2
D.Anexceptionisthrown.
E.Thecodewillnotcompile.