Why two strings cannot be equalled?
The code I write is:
//Define two JTextFields
JTextField jtf1,jtf2;
//After pressing button of responding
if (jtf1.getText()==jtf2.getText()) {
System.out.println("Hello");
}
//The end
I just find that I cannot get into the loop of if, even when the inputs of jtf1 and jtf2 are all the same strings.
Why?

No comments:
Post a Comment