Online Java Compiler By
JavaTpoint.com
import java.net.HttpCookie; public class JavaHttpCookieGetPathExample1 { public static void main(String[] args) { HttpCookie cookie = new HttpCookie("Student", "2"); cookie.setPath("189.144.22.5/user/index.html"); // Return the path on the server for which the browser return the cookie. System.out.println("The path is given as: "+ cookie.getPath()); } }
Output