URL.hashCode() has the following syntax.
public int hashCode()
In the following code shows how to use URL.hashCode() method.
import java.io.IOException; import java.net.URL; // www . j a v a 2 s . co m public class Main { public static void main(String[] args) { try { URL url = new URL("http://www.java2s.com"); System.out.println("URL is " + url.hashCode()); } catch (IOException e) { e.printStackTrace(); } } }
The code above generates the following result.