Answer the question
In order to leave comments, you need to log in
Why does comparing different values of a value type return true?
Good day. Why does comparing different values of a value type return true in this case? Specifically, on line 100, the condition always returns true, although it is clear that they are not equal.
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
int int1 = editText.getText().toString().length();
int int2 = currentWord.getEnglishWord().toString().length();
String string1 = editText.getText().toString();
String string2 = currentWord.getEnglishWord();
if(string1.length() == string2.length());
{
if(editText.getText().toString().equals(currentWord.getEnglishWord()))
{
Toast.makeText(getContext(), "WIIIIIIN!!!!", Toast.LENGTH_SHORT).show();
}else
{
int g =int1 + int2;
string1 +=string2;
Toast.makeText(getContext(), "LOOOOSE!!!!", Toast.LENGTH_SHORT).show();
}
}
}
Answer the question
In order to leave comments, you need to log in
Why do you need a semicolon at the end of the if statement ?!!!!
You understand that in this case your comparison operator is simply wasted!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question