Java string.hashcode() giving differing values
<p>I've been stuck at this problem for a few hours now. I've commented out all code thinking it was something to do with array out of bounds but this is still happening. I'm trying to read input from a file using scanner, storing data and getting that data later using the hashcode. But the hashed value keeps changing.</p>

<pre><code>public static void main(String[] args)
{
    //only prior code is to access data
    char arr[] = new char[25];
    arr = readString.toCharArray();
    int y;
    y = hash(arr);
}

public static int hash(char[] arr)
{
    int get = arr.toString().hashCode();
    System.out.println(y);
    return get; 
}
</code></pre>

<p>for the file, even with same thing on every line, there is still this problem<br>
ex.<br>
hello<br>
hello<br>
hello<br></p>

<p>i've commented out all other functions except to get the data and hash it but not sure why hashcode has differnt values. Am I using hashcode incorrectly? Is there another way to do this?</p>

<p>Edit* When I hash strings, inside main funcitons, value is always the same, but values that I retrieve have never been the same. </p>
