Java HttpCookie getMaxAge() MethodThe getMaxAge() method of Java HttpCookie class is used to return the maximum age of the cookie within the seconds. By default, -1 represents that the given cookie exists until the browser is shut down. SyntaxParameterN.A. ReturnThe above method is used to return an integer which specifies the maximum age of the cookie within seconds. Example 1Test it NowOutput: The maximum age of the cookie is given as: 1700 Example 2Test it NowOutput: The maximum age of the first cookie is given as: 2000 The maximum age of the second cookie is given as: 1000 Example 3Test it NowOutput: The maximum age of the cookie is given as: -1 Next TopicgetName() Method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India