I have two identical strings, one in an array and one in a String variable. When I compare these IDENTICAL strings I get false every time. I have debugged and debugged, but I get the same result every time. Here is the code in question
String temp = ""+(num1*num2);
Boolean equal = temp == answers[i];
if(equal) {
correct[i] = true;
num_correct ++;
}else{
correct[i] = false;
}
Again, I have debugged every minor detail of this program and I am 101% sure that the strings are IDENTICAL. Why is Java returning false on comparison?