Online Java Compiler By
JavaTpoint.com
import java.net.HttpCookie; public class JavaHttpCookieSetCommentExample3 { public static void main(String[] args) { HttpCookie cookie1 = new HttpCookie("Student1", "121"); HttpCookie cookie2 = new HttpCookie("Student2", "122"); // Specifies a comment which describes the purpose of the cookie. cookie1.setComment("This is the first cookie."); cookie2.setComment("This is the second cookie."); System.out.println("Comment1 : "+cookie1.getComment()); System.out.println("Comment2 : "+cookie2.getComment()); } }
Output