HttpCookie GetValue() Example

Started by VelMurugan, Dec 24, 2008, 09:50 PM

Previous topic - Next topic

VelMurugan

HttpCookie GetValue() Example

Returns the value of the cookie.

HttpCookieclass GetValue() method example. This example shows you how to use GetValue() method.This method Returns the value of the cookie.

Here is the code:-


/*
* @Program that Returns the value of the cookie.
* GetValue.java
* Author:-RoseIndia Team
* Date:-25-Jun-2008
*/

import java.net.*;

public class GetValue {

    public static void main(String[] args) throws Exception {
        String name = "Roseindia";
        String value = "ABC";
        HttpCookie hc = new HttpCookie(name, value);
        //Returns the value of the cookie.
         System.out.println("The value of the cookie is:"+hc.getValue());
    }
}


Output of the program:-

The value of the cookie is:ABC

Source : codingdiary