Multiple choice

Which of the following methods of the HttpSession interface of java servlet is used to remove the session from the context ?

  1. void invalidate()

  2. void removeAttribute(String attr)

  3. void setAttribute(String attr, Object val))

  4. both (1) and (2)

  5. none of the above

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Yes, this method is used to invalidate the particular session and removes it from the context.