Online Java Compiler By
JavaTpoint.com
import java.net.HttpCookie; public class JavaHttpCookieGetNameExample2 { public static void main(String[] args) { HttpCookie cookie1 = new HttpCookie("Student1", "5"); HttpCookie cookie2 = new HttpCookie("Student2", "6"); System.out.println("The name of the first cookie is given as: "+ cookie1.getName()); System.out.println("The name of the second cookie is given as: "+ cookie2.getName()); } }
Output