阿摩線上測驗 登入

試題詳解

試卷:無年度 - Java EE 6 Web Component Developer Certified Expert Exam:1z0-899(51-100)#84004 | 科目:OCE

試卷資訊

試卷名稱:無年度 - Java EE 6 Web Component Developer Certified Expert Exam:1z0-899(51-100)#84004

科目:OCE

複選題
77 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 Servlet A 
Which two changes, taken together, ensure that value is equal to "Hello" on line 23? (Choose two)
(A)ensure that the Servlet Bservice method is synchronized
(B)ensure that the Servlet A service method is synchronized
(C)ensure that Servlet B synchronizes on the session object when setting session attributes
(D)enclose lines 21-22 in synchronized block:synchronized(this) (session.setAttribute(key, "Hello");value = session.getAttribute(key);)
(E) enclose lines 21-22 in synchronized block:synchronized(session) (session.setAttribute(key, "Hello");value = session.getAttribute(key);)
正確答案:登入後查看