Oracle
1Z0-899 · Question #29
Given an HttpServletRequestrequest and HttpResponseresponse, which sets a cookie "username" with the value "joe" in a servlet?
The correct answer is F. response.addCookie(new Cookie("username", "joe")). See the full explanation below for the reasoning.
Question
Given an HttpServletRequestrequest and HttpResponseresponse, which sets a cookie "username" with the value "joe" in a servlet?
Options
- Arequest.addCookie("username", "joe")
- Brequest.setCookie("username", "joe")
- Cresponse.addCookie("username", "joe")
- Drequest.addHeader(new Cookie("username", "joe"))
- Erequest.addCookie(new Cookie("username", "joe"))
- Fresponse.addCookie(new Cookie("username", "joe"))
- Gresponse.addHeader(new Cookie("username", "joe"))
How the community answered
(25 responses)- B4% (1)
- C8% (2)
- F84% (21)
- G4% (1)
Community Discussion
No community discussion yet for this question.