Get the identity hash codes : hashCode « Class « Java






Get the identity hash codes

 

import java.io.File;

public class Main {
  public static void main(String[] argv) throws Exception {
    File file1 = new File("a");
    File file2 = new File("a");
    File file3 = new File("b");

    int ihc1 = System.identityHashCode(file1);
    System.out.println(ihc1);
    int ihc2 = System.identityHashCode(file2);
    System.out.println(ihc2);
    int ihc3 = System.identityHashCode(file3);
    System.out.println(ihc3);

  }
}

   
  








Related examples in the same category

1.Comparing Object Values Using Hash Codes