Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFJS - final mock - q55

 
Steven Colley
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please, could anyone explain this question to me?

what the answer is "BBUBUB" ?

Tks.
 
senthil rajan
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frnds,
Its a unsolvable problem for me too...

Can anybody give some idea about this???

Thanks,
Senthil.
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey dudes
can you tell what exactly that constant means.. is it an answer to a question? or any other technical term?

Good times ahead.
Raghavan alias Saravanan M
 
Jigar Gosar
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if BBUBUB is correct than, it can be infered that, when setAttribute is called for the second time than valueBound(for second attribute) is called before valueUnbound (for first attribute) is called.

I have read the spec but it doesnot specify the order in which valueBound valueUnbound methods are called.

so, can some one tell me the order in which methods valueBound/valueUnbound of Interface HttpSessionBindingListener will be called for the following code.
assume there is a class called X that implements HttpSessionBindingListener. Now,


according to me the order must be
1. valueBound - for first object X()
2. valueUnbound - for first object X()
3. valueBound - for second object X()

but according to the answers of q55 final mock exam HFSJ, the order is

1. valueBound - for first object X()
2. valueBound - for second object X()
3. valueUnbound - for first object X()

can someone tell me the correct order in which these functions are called.

thanks.
[ April 22, 2006: Message edited by: Jigar Gosar ]
 
Akshay Kiran
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




clearly, the order of execution is
valueBound for the first one
valueBound for the second one (because the value of the first one will be unBound only after it is replaced)
valueUnbound for the first one
(here, the string value is added, but the String class doesn't implement the HttpSessionBindingListener, so valueBound or Unbound won't be called for adding or removing "x")
valueUnbound for the second one (because it has now been replaced by "x")

so clearly, the outpu will be
B B UB UB
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic