HttpCookie SetComment() Example
Specifies a comment that describes a cookie's purpose.
HttpCookieclass SetComment() method example. This example shows you how to use SetComment() method.This method Specifies a comment that describes a cookie's purpose.
Here is the code:-
/*
* @Program that Specifies a comment that describes a cookie's purpose
* SetComment.java
* Author:-RoseIndia Team
* Date:-26-Jun-2008
*/
import java.net.*;
public class SetComment {
public static void main(String[] args) throws Exception {
String name = "Roseindia";
String value = "ABC";
HttpCookie hc = new HttpCookie(name, value);
//Specifies a comment that describes a cookie's purpose.
hc.setComment("The cokkie describing the Name");
//Returns the comment describing the purpose of this cookie
System.out.println("Purpose of this cookie:" +hc.getComment());
}
} |
Output of the program:-
| Purpose of this cookie:The cokkie describing the Name |
|