How would you rewrite this using a switch statement?
String checkZero(int x)
{
String s;
if (x == 0)
s = "zero";
else
s = "non-zero";
return s;
}
Which do you think is the best choice for this method? Why?
How would this work for Java?