Olá
Estou com dúvida na questão 55 do mock final do Head First Servlets & JSP
Enunciado:
Dado:public class ServletX extends HttpServlet{
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException{
req.getSession().setAttribute("key",new X());
req.getSession().setAttribute("key",new X());
req.getSession().setAttribute("key","x");
req.getSession().removeAttribute("key");
}
}
public class X implements HttpSessionBindingListener{
public void valueBound(HttpSessionBindingEvent event){
System.out.print("B");
}
public void valueUnbound(HttpSessionBindingEvent event){
System.out.print("UB");
}
}
A resposta no livro está BBUBUB, mas não entendi por quê, no livro não explicou direito. Eu achei que deveria ser BBBUB, mas nem tem alternativa com essa resposta.