+ 5

Can anyone help?

Please check, inspect and run this program and please tell me why it is showing compilation error. https://code.sololearn.com/cyW7jxvOIjQ6/?ref=app

10th Apr 2019, 11:22 AM
anon
6 ответов
+ 5
https://code.sololearn.com/c3BtMvjXmSfZ/?ref=app To fix your code I had to remove or comment out the break statement (if, else if, else don't use break); enclose multiple statements within curly braces when following an if, else if or else; replace the non printable characters with printable ones, e.g. '@'.
10th Apr 2019, 12:29 PM
Sonic
Sonic - avatar
10th Apr 2019, 2:44 PM
Daljeet Singh
Daljeet Singh - avatar
+ 1
Where is the switch in your code?
10th Apr 2019, 11:44 AM
HonFu
HonFu - avatar
+ 1
1) Use braces { } to pack multiple lines after if or else statements. 2) break is only allowed in loops or switch statements, not in your if/else-construct. 3) seems like the character you chose cannot be mapped. I tried it with x instead of your dot and it worked.
10th Apr 2019, 12:16 PM
Matthias
Matthias - avatar
0
Java doesn’t recognize the character, maybe use some kind og UTF encoding? Also, brackets around multiple statements in conditionals eg. if(condition) {statement1; statement2}
10th Apr 2019, 2:29 PM
Truls Nilsen
Truls Nilsen - avatar