• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Q55 HFSJ Mock Exam - Important exam in 3 hours

 
Neil Renaud
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think the answer to question 55 is right in my book.

It is a question about setting session attributes and binding listeners.

Where X is a HttpSessionBindingListener and prints B when bound and UB when unbound

The following code

req.getSession().setAttribute("key", new X());
req.getSession().setAttribute("key", new X());
req.getSession().setAttribute("key", "x");
req.getSession().removeAttribute("key");

produces the following output according to the correct answer

"BBUBUB"

I don't see how this can be as a set will replace an attribute, if the following output is correct it means their is a very small amount of time where using the setAttribute method has resulted in key having two values.

Surly this should be BUBBUB?

Can anyone explain this to me?

Neil
 
Pawan Ramchandani
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The question is already asked by some other guy you can find answer here.

http://www.coderanch.com/t/169968/java-Web-Component-SCWCD/certification/HttpSessionBindingListener

All the best
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic