niusouti.com

Given:  foo and bar are public references available to many other threads, foo refers to a Thread and bar is an Object. The thread foo is currently executing bar.wait().  From another thread, what provides the most reliable way to ensure that foo will sto

题目

Given:  foo and bar are public references available to many other threads, foo refers to a Thread and bar is an Object. The thread foo is currently executing bar.wait().  From another thread, what provides the most reliable way to ensure that foo will stop executing wait()?()

  • A、foo.notify();
  • B、bar.notify();
  • C、foo.notifyAll();
  • D、Thread.notify();
  • E、bar.notifyAll();
  • F、Object.notify();

相似考题
更多“Given:  foo an”相关问题
  • 第1题:

    Given:Which three methods, inserted individually at line 14, will correctly complete class Two?()

    A.int foo() { /* more code here */ }

    B.void foo() { /* more code here */ }

    C.public void foo() { /* more code here */ }

    D.private void foo() { /* more code here */ }

    E.protected void foo() { /* more code here */ }


    参考答案:B, C, E

  • 第2题:

    Given:Which code, inserted at line 15, allows the class Sprite to compile?()

    A.Foo { public int bar() { return 1; }

    B.new Foo { public int bar() { return 1; }

    C.new Foo() { public int bar() { return 1; }

    D.new class Foo { public int bar() { return 1; }


    参考答案:C

  • 第3题:

    Given:Whichthreecodefragments,insertedindependentlyatline6,willcompile?()

    A.list.add("foo");

    B.Objecto=list;

    C.Strings=list.get(0);

    D.list=newArrayList();


    参考答案:B, C, D

  • 第4题:

    Given: 6.<% int[] nums = {42, 420, 4200}; 7.request.setAttribute("foo", nums); %> Which two successfully translate and result in a value of true?()

    • A、${true or false}
    • B、${requestScope[foo][0] > 500}
    • C、${requestScope[’foo’][1] = 420}
    • D、${(requestScope[’foo’][0] lt 50) && (3 gt 2)}

    正确答案:A,D

  • 第5题:

    Given:  8.int index = 1:  9.Boolean [] test = new boolcan [3];  10.boolcan foo = test [index];   What is the result()?  

    • A、 foo has the value of 0.
    • B、 foo has the value of null.
    • C、 foo has the value of true.
    • D、 foo has the value of false.
    • E、 An-exception is thrown.
    • F、 The code will not compile.

    正确答案:D

  • 第6题:

    Given the HttpServlet code:   getServletContext().setAttribute(“foo”, “value”); What is the result?()

    • A、 The attribute foo is placed in the application
    • B、 A ServletContextListener registered for that servlet is notified
    • C、 A ServletAttributeListener registered for that servlet is notified
    • D、 An HttpSessionAttributeListener registered for that servlet is notified

    正确答案:A

  • 第7题:

    多选题
    Given:   10. class One {   11. void foo() { }   12. }   13. class Two extends One {   14. //insert method here   15. }   Which three methods, inserted individually at line 14, will correctly complete class Two?()
    A

    public void foo() { /* more code here */ }

    B

    private void foo() { /* more code here */ }

    C

    protected void foo() { /* more code here */ }

    D

    int foo() { /* more code here */ }

    E

    void foo() { /* more code here */ }


    正确答案: A,D
    解析: 暂无解析

  • 第8题:

    多选题
    Given: String value = getServletContext().getInitParameter("foo"); in an HttpServlet and a web applicationdeployment descriptor that contains: foo frodo Which two are true?()
    A

    The foo initialization parameter CANNOT be set programmatically.

    B

    Compilation fails because getInitParameter returns type Object.

    C

    The foo initialization parameter is NOT a servlet initialization parameter.

    D

    Compilation fails because ServletContext does NOT have a getInitParameter method.

    E

    The foo parameter must be defined within the  element of the deployment descriptor.


    正确答案: C,E
    解析: 暂无解析

  • 第9题:

    单选题
    Given:  8.int index = 1:  9.Boolean [] test = new boolcan [3];  10.boolcan foo = test [index];   What is the result()?
    A

     foo has the value of 0.

    B

     foo has the value of null.

    C

     foo has the value of true.

    D

     foo has the value of false.

    E

     An-exception is thrown.

    F

     The code will not compile.


    正确答案: F
    解析: 暂无解析

  • 第10题:

    单选题
    Given an EL function foo, in namespace func, that requires a long as a parameter and returns a Map, which two are valid invocations of function foo?()
    A

     ${func(1)}

    B

     ${foo:func(4)}

    C

     ${func:foo(2)}

    D

     ${foo(5):func}

    E

     ${func:foo(“easy”)}

    F

     ${func:foo(“3”).name}


    正确答案: A
    解析: 暂无解析

  • 第11题:

    单选题
    Given the HttpServlet code:   getServletContext().setAttribute(“foo”, “value”); What is the result?()
    A

     The attribute foo is placed in the application

    B

     A ServletContextListener registered for that servlet is notified

    C

     A ServletAttributeListener registered for that servlet is notified

    D

     An HttpSessionAttributeListener registered for that servlet is notified


    正确答案: B
    解析: 暂无解析

  • 第12题:

    单选题
    Given: Which code, inserted at line 16, will cause a java.lang.ClassCastException?()
    A

    Alpha a = x;

    B

    Foo f = (Delta)x;

    C

    Foo f = (Alpha)x;

    D

    Beta b = (Beta)(Alpha)x;


    正确答案: B
    解析: 暂无解析

  • 第13题:

    Given:Which code, inserted at line 16, will cause a java.lang.ClassCastException?()

    A.Alpha a = x;

    B.Foo f = (Delta)x;

    C.Foo f = (Alpha)x;

    D.Beta b = (Beta)(Alpha)x;


    参考答案:B

  • 第14题:

    Given:fooandbararepublicreferencesavailabletomanyotherthreads.fooreferstoaThreadandbarisanObject.Thethreadfooiscurrentlyexecutingbar.wait().Fromanotherthread,whatprovidesthemostreliablewaytoensurethatfoowillstopexecutingwait()?

    A.foo.notify();

    B.bar.notify();

    C.foo.notifyAll();

    D.Thread.notify();

    E.bar.notifyAll();


    参考答案:E

  • 第15题:

    Given: 3.public class MyTagHandler extends TagSupport { 4.public int doStartTag() { 5.// insert code here 6.// return an int 7.} 8.// more code here ... 18.} There is a single attribute foo in the session scope. Which three code fragments,inserted independently atline 5,return the value of the attribute?()

    • A、Object o = pageContext.getAttribute("foo");
    • B、Object o = pageContext.findAttribute("foo");
    • C、Object o = pageContext.getAttribute("foo",PageContext.SESSION_SCOPE);
    • D、HttpSession s = pageContext.getSession();Object o = s.getAttribute("foo");

    正确答案:B,C,D

  • 第16题:

    Given an EL function foo, in namespace func, that requires a long as a parameter and returns a Map,which two are valid invocations of function foo?()

    • A、${func(1)}
    • B、${foo:func(4)}
    • C、${func:foo(2)}
    • D、${foo(5):func}
    • E、${func:foo("easy")}
    • F、${func:foo("3").name}

    正确答案:C,F

  • 第17题:

    Given the JSP code: <% request.setAttribute("foo", "bar"); %>and the Classic tag handler code: 5. public int doStartTag() throws JspException { 6. // insert code here 7. // return int 8. } Assume there are no other "foo" attributes in the web application. Which invocation on the pageContextobject,inserted at line 6,assigns "bar" to the variable x?()

    • A、String x = (String) pageContext.getAttribute("foo")
    • B、String x = (String) pageContext.getRequestScope("foo")
    • C、It is NOT possible to access the pageContext object from within doStartTag
    • D、String x = (String) pageContext.getRequest().getAttribute("foo")
    • E、String x = (String) pageContext.getAttribute("foo", PageContext.ANY_SCOPE)

    正确答案:D

  • 第18题:

    Given: foo and bar are public references available to many other threads. foo refers to a Thread and bar is anObject.  The thread foo is currently executing bar.wait().  From another thread,what provides the most reliable wayto ensure that foo will stop executing wait()?

    • A、foo.notify();
    • B、bar.notify();
    • C、foo.notifyAll();
    • D、Thread.notify();
    • E、bar.notifyAll();

    正确答案:E

  • 第19题:

    多选题
    Given: Which three methods, inserted individually at line 14, will correctly complete class Two?()
    A

    int foo() { /* more code here */ }

    B

    void foo() { /* more code here */ }

    C

    public void foo() { /* more code here */ }

    D

    private void foo() { /* more code here */ }

    E

    protected void foo() { /* more code here */ }


    正确答案: D,B
    解析: 暂无解析

  • 第20题:

    多选题
    Given: 6. Which two successfully translate and result in a value of true?()
    A

    ${true or false}

    B

    ${requestScope[foo][0] > 500}

    C

    ${requestScope[’foo’][1] = 420}

    D

    ${(requestScope[’foo’][0] lt 50) && (3 gt 2)}


    正确答案: A,C
    解析: 暂无解析

  • 第21题:

    单选题
    Given:  foo and bar are public references available to many other threads, foo refers to a Thread and bar is an Object. The thread foo is currently executing bar.wait().  From another thread, what provides the most reliable way to ensure that foo will stop executing wait()?()
    A

    foo.notify();

    B

    bar.notify();

    C

    foo.notifyAll();

    D

    Thread.notify();

    E

    bar.notifyAll();

    F

    Object.notify();


    正确答案: C
    解析: 暂无解析

  • 第22题:

    多选题
    Given: String value = getServletContext().getInitParameter("foo"); in an HttpServlet and a web applicationdeployment descriptor that contains: foo frodo Which two are true?()
    A

    The foo initialization parameter CANNOT be set programmatically.

    B

    Compilation fails because getInitParameter returns type Object.

    C

    The foo initialization parameter is NOT a servlet initialization parameter.

    D

    Compilation fails because ServletContext does NOT have a getInitParameter method.

    E

    The foo parameter must be defined within the  element of the deployment descriptor.


    正确答案: A,C
    解析: 暂无解析

  • 第23题:

    单选题
    Given: foo and bar are public references available to many other threads. foo refers to a Thread and bar is anObject.  The thread foo is currently executing bar.wait().  From another thread,what provides the most reliable wayto ensure that foo will stop executing wait()?
    A

    foo.notify();

    B

    bar.notify();

    C

    foo.notifyAll();

    D

    Thread.notify();

    E

    bar.notifyAll();


    正确答案: C
    解析: 暂无解析