Online Java Compiler By
JavaTpoint.com
import java.net.HttpCookie; public class JavaHttpCookieEqualsExample2 { public static void main(String[] args) { HttpCookie cookie1 = new HttpCookie("Employee", "01"); HttpCookie cookie2 = new HttpCookie("Student", "10"); boolean bool = cookie1.equals(cookie2); if(bool) { System.out.println("Both cookies come from same path and same domain."); } else { System.out.println("Cookies are different."); } } }
Output