HttpCookie GetComment() Example
Returns the comment describing the purpose of this cookie,
HttpCookieclass GetComment() method example. This example shows you how to use GetComment() method.This method Returns the comment describing the purpose of this cookie, or null if the cookie has no comment.
Here is the code:-
/*
* @Program that Returns the comment describing the purpose of this cookie
* GetComment.java
* Author:-RoseIndia Team
* Date:-25-Jun-2008
*/
import java.net.*;
public class GetComment {
public static void main(String[] args) throws Exception {
String name = "Name";
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 |
|