Hi,
I am having some problems with Arrays.equals. I can't get it to return true and I can't see the problem.
public void testing() { boolean check = Arrays.equals(test, test2); if (check == false) { System.out.println("Word is not a palindrome!"); for ( int i=0; i < test.length; i++){ System.out.println(test[i] + " " + test2[i]); } } else { System.out.println("Word is a palindrome!"); for ( int i=0; i < test.length; i++){ System.out.println(test[i] + " " + test2[i]); } System.out.println("Isn't this an exciting game!"); } }
test is a word input by the user, test2 is test copied to test2 and reversed. If I print the arrays they seem to be the same. If i change it to compare test to test or test2 to test2 it tells me they are the same so I guess I am just missing something. Can anyone point me in the right direction?
Thanks