Online Java Compiler By
JavaTpoint.com
import java.net.HttpCookie; public class JavaHttpCookieGetNameExample1 { public static void main(String[] args) { HttpCookie cookie = new HttpCookie("Student", "4"); // Return the name of the cookie. System.out.println("The name of the cookie is given as: "+ cookie.getName()); } }
Output