File HashCode() Example
Computes a hash code for this abstract pathname.
File class HashCode() method example. This example shows you how to use HashCode method.This method Computes a hash code for this abstract pathname.
Here is the code:-
/**
* @Program that Computes a hash code for this abstract pathname.
* HashCode.java
* Author:-RoseIndia Team
* Date:-30-May-2008
*/
import java.io.*;
public class HashCode {
public static void main(String[] args) {
File f = new File("/home/girish/Desktop/g.txt");
if (f.exists()) {
int i=f.hashCode();
System.out.println("Hash code for this pathname is : " + i);
} else {
System.out.println("File does not exists");
}
}
} |
Output of the Program
| Hash code for this pathname is : -675196601 |
|