I have a String response_content
of length=1 in a java project and I know that it equals to 1 (ASCII 49). I know this, because the following lines (in Eclipse with android ADT+SDK)
Log.i("GET RESPONSE", response_content);
Log.i("GET RESPONSE", response_content.length());
Log.i("GET RESPONSE", response_content.codePointAt(0));
produce this output:
1
1
49
But why do these lines always return false?
if (response_content.equals(1)) {...}
if (response_content == "1") {...}
I know equals()
is the adequate way, ==
is just for testing purposes.
Is there another way of telling me, what the string really contains or is there a mistake I don't see?