URL hashCode Example

URL class hashCode example. This example shows you how to use hashCode method.


URL class hashCode example. public int hashCode() Creates an integer suitable for hash table indexing. The hash code is based upon all the URL components relevant for URL comparison. As such, this operation is a blocking operation.

Here is the code
/*
 * @ # HashCode.java
 * A class repersenting use to hashCode method 
 * of URL class in java.net package
 * version 24 June 2008
 * author Rose India 
 */

import java.net.*;

public class HashCode {
    public static void main(String args[]) throws Exception {

        URL url = new URL("http://java.sun.com?login=true");

        System.out.println(
"hash code = " + url.hashCode());
    }
}

Output
hash code = -669254932

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US