0

Email that I enter in TextField in this section of code is exactly equal to the email in one of the accounts in the array list, but every no has is true. Where is the problem??

 boolean has = false;
            for (Account value : accounts) {
                if (value.email == email.getText().trim() && value.password == password.getText().trim()) {
                    has = true;
                }
            }
  • 2
    Because you are trying to compare a string with == instead of `.equals()` – sleepToken Jan 24 '20 at 14:50
  • 3
    Does this answer your question? [How do I compare strings in Java?](https://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java) – sleepToken Jan 24 '20 at 14:51

0 Answers0