I constantly run this program on one computer:
class Test {
public static void main(String[] args) {
Test test = new Test();
System.out.println(test.hashCode());
}
}
The result is the same every time I run the program on my computer (Windows 7 64 bit): 4384790
On another machine (Windows Server 2008, 64 bit), in most cases this gives me: 1671711. However, several times the result: 11394033.
On my computers, I run the program under Java HotSpot (TM) Client VM 1.6.0_26 / 1.6.0_33
I read the documentation for the Object class:
As reasonably practical, the hashCode method defined by the Object class returns different integers for different objects. (This is usually implemented by converting the internal address of the object to an integer, but this implementation technique is not required by the JavaTM programming language.)
hashCode() , , Java VM Test , .
Is , hashCode() ?