HttpCookie GetName() Example
Returns the name of the cookie.
HttpCookieclass GetName() method example. This example shows you how to use GetName() method.This method Returns the name of the cookie.
Here is the code:-
/*
* @Program that Returns the name of the cookie.
* GetName.java
* Author:-RoseIndia Team
* Date:-25-Jun-2008
*/
import java.net.*;
public class GetName {
public static void main(String[] args) throws Exception {
String name = "Roseindia";
String value = "ABC";
HttpCookie hc = new HttpCookie(name, value);
System.out.println(" Name of the cookie is: "+hc.getName());
}
} |
Output of the program:-
| Name of the cookie is: Roseindia |
|