Online Java Compiler By
JavaTpoint.com
import java.net.HttpCookie; public class JavaHttpCookieGetPathExample2 { public static void main(String[] args) { HttpCookie cookie1 = new HttpCookie("Student1", "4"); HttpCookie cookie2 = new HttpCookie("Student2", "5"); cookie1.setPath("189.144.22.5/user/index1.html"); cookie2.setPath("145.132.19.6/client/index2.html"); // Return the path on the server for which the browser return the cookie. System.out.println("The first path is given as: "+ cookie1.getPath()); System.out.println("The second path is given as: "+ cookie2.getPath()); } }
Output