Given the code fragment:
How long does this cookie persist?
Given the code fragment:
How long does this cookie persist?
The code fragment creates a new cookie and sets its maximum age to -1 using the setMaxAge(-1) method. According to the Java Servlet API documentation, a max age of -1 indicates that the cookie should persist until the browser session ends, meaning it will be retained until the browser is shut down. Therefore, the cookie will last until the browser is closed.
Answer D