Java HttpCookie setComment() 方法

2025 年 3 月 22 日 | 阅读需 2 分钟

HttpCookie 类的 setComment(String purpose) 方法用于指定一个描述 cookie 用途的注释。Netscape 0 版本 cookie 不支持注释。

语法

参数

上述方法只需要一个参数

  1. purpose - 表示一个 String,进一步指定了直接对用户可见的注释。

返回

不适用

示例 1

输出

Comment : Java is a programming language.

示例 2

输出

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

示例 3

输出

Comment1 : This is the first cookie.
Comment2 : This is the second cookie.
下一个主题setCommentURL() 方法