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[] argsthrows 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));
    }
}

Output of the program:-
 Cookies are equal: true

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

HOME | COPYRIGHT | CONTACT US