Multiple choice technology web technology

The maximum age of the cookie in JSP can be set by

  1. cookie.setMaxAge(int seconds)

  2. cookie.setMaxAge(float seconds)

  3. cookie.setAgeMax (float seconds)

  4. cookie.setAgeMax (int seconds)

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

The Cookie class in Java servlets/JSP uses setMaxAge(int seconds) to set the cookie's maximum age in seconds. The parameter must be an integer, not a float. Negative values delete the cookie, zero deletes it immediately, and positive values set the expiration time.