GiventheHttpServletcode:getServletContext().setAttribute(“foo”,“value”);Whatistheresult?()A.TheattributefooisplacedintheapplicationB.AServletContextListenerregisteredforthatservletisnotifiedC.AServletAttributeListenerregisteredforthatservletisnotifiedD.An

题目
GiventheHttpServletcode:getServletContext().setAttribute(“foo”,“value”);Whatistheresult?()

A.Theattributefooisplacedintheapplication

B.AServletContextListenerregisteredforthatservletisnotified

C.AServletAttributeListenerregisteredforthatservletisnotified

D.AnHttpSessionAttributeListenerregisteredforthatservletisnotified


相似考题
更多“GiventheHttpServletcode:getServletContext().setAttribute(“foo”,“value”);Whatistheresult?() ”相关问题
  • 第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)


    参考答案:D

  • 第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


    参考答案:D

  • 第3题:

    publicclassDelta{staticbooleanfoo(charc){System.out.print(c);returntrue;}publicstaticvoidmain(String[]argv){inti=0;for(foo(‘A’);foo(‘B’)&&(i<2);foo(‘C’)){i++;foo(‘D’);}}}Whatistheresult?()

    A.ABDCBDCB

    B.ABCDABCD

    C.Compilationfails.

    D.Anexceptionisthrownatruntime.


    参考答案:A

  • 第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.


    参考答案:A

  • 第5题:

    intindex=1;int[]foo=newint[3];intbar=foo[index];intbaz=bar+index;Whatistheresult?()

    A.Bazhasthevalueof0

    B.Bazhasthevalueof1

    C.Bazhasthevalueof2

    D.Anexceptionisthrown.

    E.Thecodewillnotcompile.


    参考答案:B