nerdexam
Oracle

1Z0-899 · Question #177

1Z0-899 Question #177: Real Exam Question with Answer & Explanation

Sign in or unlock 1Z0-899 to reveal the answer and full explanation for question #177. The question stem and answer options stay visible for context.

Question

Given that a web application consists of two HttpServlet classes, ServletA and ServletB, and the ServerletA.service method: 20. String key = "com.example.data"; 21. session.setAttribute(key, "Hello"); 22. object value = session.getAttribute(key); 23. Assume session is an HttpSession, and is not referenced anywhere else in ServletA. Which two changes, taken together, ensure that value is equal to "Hello" on line 23? (Choose two)

Options

  • Aensure that the ServletB.service method is synchronized
  • Bensure that the ServletA.service method is synchronized
  • Censure that ServletB synchronizes on the session object when setting session attributes
  • Denclose lines 21-22 in synchronized block:
  • Eenclose lines 21-22 in synchronized block:

Unlock 1Z0-899 to see the answer

You've previewed enough free 1Z0-899 questions. Unlock 1Z0-899 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full 1Z0-899 Practice