What is Cookies and what is the use of Cookies ?

A "cookie" is a small piece of information sent by a web server to store on a web browser so it can later be read back from that browser. This is useful for having the browser remember some specific information. 
  • to create a temporary session where the site in some way "remembers in the short term" what the user was doing or had chosen between web page requests, e.g. remembering who the user is logged in as at the moment, or what they've ordered from an on-line "shopping cart";
  • to remember low-security information more permanently: for example, to remember a user's search results preferences or who they are logged in as on their social bookmarking site;
  • to compile user statistics, e.g. for advertising purposes or for improving the functionality of a site. 

Getting the Value of a Cookie with a Specified Name :

for(int i=0; i<cookies.length; i++)
{
Cookie cookie = cookies[i];
 if (cookieName.equals(cookie.getName()))
return(cookie.getValue());
 }
return(defaultValue);


Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email