bilsch wrote:
Now that you mention it I see how that would work. However the actual
program has many non-numeric buttons I don't want in the string - I
better leave that alone for the present.
A couple of things. First, even if true, it's better to do something
like this:
if( btn == "1" || btn == "2" || btn == "3" ... )
{
// one single case here...
}
Than it is to use many different if-blocks. Same action for different
inputs, you want to use one code block to implement that action.
One other important point I'd like to make is that Java strings don't
normally compare with ==. You have to use .equals() instead. Your code
works now because all of the strings are in a single file, but as your
program grows == will no longer work for you.
This is the normal, and more correct, way to do it:
if( btn.equals( "1" ) || btn.equals( "2" ) || ... )
{
strng1 += btn;
}