Java URL.hashCode()

Syntax

URL.hashCode() has the following syntax.

public int hashCode()

Example

In the following code shows how to use URL.hashCode() method.


import java.io.IOException;
import java.net.URL;
/*from w w w .ja  v a  2s . 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.





















Home »
  Java Tutorial »
    java.net »




CookieManager
CookiePolicy
CookieStore
DatagramPacket
DatagramSocket
HttpCookie
HttpURLConnection
InetAddress
JarURLConnection
MulticastSocket
ServerSocket
Socket
SocketAddress
URI
URL
URLConnection
URLDecoder
URLEncoder