GSNA · Question #58
GSNA Question #58: Real Exam Question with Answer & Explanation
The correct answer is A. Cookie [] cookies = request.getCookies();. The getCookies() method of the HttpServletRequest interface is used to get the cookies from a client. This method returns an array of cookies. Answer: B, C are incorrect. The getCookie(String str) method does not exist. Answer: D is incorrect. The getCookies() method is present i
Question
Options
- ACookie [] cookies = request.getCookies();
- BCookie [] cookies = request.getCookie(String str)
- CCookie [] cookies = response.getCookie(String str)
- DCookie [] cookies = response.getCookies()
Explanation
The getCookies() method of the HttpServletRequest interface is used to get the cookies from a client. This method returns an array of cookies. Answer: B, C are incorrect. The getCookie(String str) method does not exist. Answer: D is incorrect. The getCookies() method is present in the HttpServletRequest interface and not in the HttpServletResponse interface.
Community Discussion
No community discussion yet for this question.