I am getting Syntax Error on the else statement in the following code :
switch(v.getId())
{
case R.id.b0 :
if(s.length()==1 && s.charAt(0)=='0');
{
et2.setText("0");
et1.setText("0");
}
else
{
s=s+"0";
call(s);
}
break;
//2nd case and body
}
The Error is : Syntax error on token "else", delete this token
Does java not permit this?
Will I have to use the nested switch?
Or is there something wrong with my code itself?
if(s.length()==1 && s.charAt(0)=='0');
remove ;
if(s.length()==1 && s.charAt(0)=='0');
^ Remove this!
You're terminating your if statement earlier than you think you are...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With