Online Java Compiler By
JavaTpoint.com
import java.net.HttpCookie; public class JavaHttpCookieSetCommentExample1 { public static void main(String[] args) { HttpCookie cookie = new HttpCookie("Student", "101"); // Specifies a comment which describes the purpose of the cookie. cookie.setComment("Java is a programming language."); System.out.println("Comment : "+cookie.getComment()); } }
Output