Skip to content
Advertisement

Tag: statements

how to make code print Suspended instead of won

Code doesn’t output Suspended but outputs Won when the user inputs true. Can someone help explain what have I done wrong with this code, please? Answer You use = incorrectly. In your example, if(isSuspended = true) {} means: To not assigned but check, you should use == instead. or better: P.S. I think you also mixed up the if cases.

Transforming if-else into switch case throws error [Java]

I tried to convert my if-else statements into a switch case but I had the following problem. Old code: New code: First, the String database threw an error that I have to change setting/property (actually don’t know) into version 1.7?! After doing so, my cases are throwing now errors. They say: Type mismatch cannot convert from boolean to String. I

Advertisement