Java URL.equals(Object obj)
Syntax
URL.equals(Object obj) has the following syntax.
public boolean equals(Object obj)
Example
In the following code shows how to use URL.equals(Object obj) method.
import java.net.URL;
/*from w ww. j ava 2 s .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.