Online Java Compiler By
JavaTpoint.com
import java.net.HttpCookie; public class JavaHttpCookieGetValueExample2 { public static void main(String[] args) { HttpCookie cookie1 = new HttpCookie("Employee1", "21"); HttpCookie cookie2 = new HttpCookie("Employee2", "22"); cookie1.setValue("56"); cookie2.setValue("78"); // Returns the present value of the cookie. System.out.println("The present value of the first cookie is given as: "+cookie1.getValue()); System.out.println("The present value of the second cookie is given as: "+cookie2.getValue()); } }
Output