In what scenarios is it safe to have instance variables in a servlet?

  • Always safe
  • Never safe
  • When shared across sessions
  • When thread safety is guaranteed
Instance variables in a servlet are safe when they are shared across sessions and thread safety is guaranteed, ensuring that multiple requests can access them concurrently without issues.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *