Online Java Compiler By
JavaTpoint.com
import java.net.HttpCookie; public class JavaHttpCookieGetMaxAgeExample1 { public static void main(String[] args) { HttpCookie cookie = new HttpCookie("Employee", "2"); cookie.setMaxAge(1700); System.out.println("The maximum age of the cookie is given as: "+cookie.getMaxAge()); } }
Output