On 6/28/2012 4:02 AM, bilsch wrote:
> if( btn.equals( "1" ) || btn.equals( "2" ) || btn.equals( "3" )
> || btn.equals( "4" )
> || btn.equals( "5" ) || btn.equals( "6" ) || btn.equals(
> "7" ) || btn.equals( "8" )
> || btn.equals( "9" ) || btn.equals( "0" ) || btn.equals(
> "." )) {
Wow, you actually changed it. Good job.
I have to say that I like ".0123456789".contains( btn ) better. It's
much shorter.
> if (btn == "+") {
You really do need to change all of the other string comparisons to
..equals() too. This == stuff is going to fail unpredictably for you.
It tests for object identity (i.e., to objects are the same object) and
is only going to succeed for strings by luck at this point. .equals()
checks that the contents of the string are the same.
I'll stop there because any other errors might be masked by these ==
comparisons for strings.