Java HttpCookie setComment() Method

The setComment(String purpose) method of HttpCookie class is used to specify a comment which describes the purpose of the cookie. Comments are not supported by Netscape version 0 cookies.

Syntax

Parameter

The above method requires only one parameter:

  1. purpose - which denotes a String which further specifies the comment which is directly visible to the user.

Return

NA

Example 1

Test it Now

Output:

Comment : Java is a programming language.

Example 2

Test it Now

Output:

Comment : setComment() specifies a comment which describes the purpose of the cookie.

Example 3

Test it Now

Output:

Comment1 : This is the first cookie.
Comment2 : This is the second cookie.




Latest Courses