Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

query

 
geet rahane
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q from Free SCWCD Mock exam for Servlets By Nikos
# What happens when this servlet is deployed and a user hits repeatedly the refresh button of his browser? (1 correct answer)



1. The same value is always displayed.
2.The displayed value increases with every refresh.

answer 1..

but i think answer might be 2 as with Random every time we get new value...........please correct me........

thanks in advance
 
avi sinha
Ranch Hand
Posts: 453
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here Integer variable number is an instance member of the servlet. whenever a request comes container creates a new thread to handle the request NOT A DIFFERENT OBJECT . hence there is only one object of the servlet with a single & fixed value of the variable number assigned to it when the object was created.

avi sinha
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please quote your sources.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic