URL.equals(Object obj) has the following syntax.
public boolean equals(Object obj)
In the following code shows how to use URL.equals(Object obj) method.
import java.net.URL; /* ww w. j a v a 2s . c om*/ public class Main { public static void main(String[] argv) throws Exception { URL relativeURL, baseURL; baseURL = new URL("http://www.yourserver.com/"); relativeURL = new URL(baseURL, "./a.htm"); System.out.println(relativeURL.equals(baseURL)); } }
The code above generates the following result.