HttpCookie equals() Example
Test the equality of two http cookies.
HttpCookieclass equals() method example. This example shows you how to use equals() method.This method Test the equality of two http cookies.
Here is the code:-
/*
* @Program that Test the equality of two http cookies.
* equals.java
* Author:-RoseIndia Team
* Date:-25-Jun-2008
*/
import java.net.*;
public class equals {
public static void main(String[] args) throws Exception {
String name = "Name";
String value = "ABC";
HttpCookie hc = new HttpCookie(name, value);
HttpCookie hc1 = new HttpCookie("Name", "ABC");
//Test the equality of two http cookies.
System.out.println("Cookies are equal: "+hc.equals(hc1));
}
} |
|