HttpCookie GetMaxAge() Example

Returns the maximum age of the cookie, specified in seconds


HttpCookieclass GetMaxAge() method example. This example shows you how to use GetMaxAge() method.This method Returns the maximum age of the cookie, specified in seconds

Here is the code:-
/* 
 * @Program that Returns the maximum age of the cookie, specified in seconds.
 * GetMaxAge.java 
 * Author:-RoseIndia Team
 * Date:-25-Jun-2008
 */

import java.net.*;

public class GetMaxAge {

    public static void main(String[] argsthrows Exception {
        String name = "Name";
        String value = "ABC";
        HttpCookie hc = new HttpCookie(name, value);
        //Returns the maximum age of the cookie, specified in seconds.
        System.out.println("Maximum age of the cookie is: "+hc.getMaxAge());
    }
}

Output of the program:-
 Maximum age of the cookie is: -1

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US