about question enthuware.jwpv6.2.750
Posted: Tue Jul 24, 2012 5:09 am
per explanation (and my understanding as well) only "baz" variable is thread safe.
while the question says there are 2 correct options.. please explain.
code snippet:
---------------
import ...;
public CrazyServlet extends HttpServlet
{
private StringBuilder foo = new StringBuilder();
private static StringBuilder bar = new StringBuilder();
public void service(HttpServletRequest req, HttpServletResponse res)
{
StringBuilder baz = new StringBuilder();
HttpSession session = req.getSession();
}
}
-----------
while the question says there are 2 correct options.. please explain.
code snippet:
---------------
import ...;
public CrazyServlet extends HttpServlet
{
private StringBuilder foo = new StringBuilder();
private static StringBuilder bar = new StringBuilder();
public void service(HttpServletRequest req, HttpServletResponse res)
{
StringBuilder baz = new StringBuilder();
HttpSession session = req.getSession();
}
}
-----------