You need to retrieve the username cookie from an HTTP request. If this cookie does NOT exist, then the c variable will be null. Which code snippet must be used to retrieve this cookie object?
A.
Cookie c = request.getCookie("username");
B.
Cookie c = null; for ( Iterator i = request.getCookies(); i.hasNext(); ) { Cookie o = (Cookie) i.next(); if ( o.getName().equals("username") ) { c = o; break; } }
C.
Cookie c = null; for ( Enumeration e = request.getCookies(); e.hasMoreElements(); ) { Cookie o = (Cookie) e.nextElement(); if ( o.getName().equals("username") ) { c = o; break; } }
D.
Cookie c = null; Cookie[] cookies = request.getCookies(); for ( int i = 0; i < cookies.length; i++ ) { if ( cookies[i].getName().equals("username") ) { c=cookies[i]; break; } }