Who can tell me what is the problems with this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Who can tell me what is the problems with this code?

public class Program{ public static void main(String[] args) { String opp ="Out"; switch(opp) { case "Out" : System.out.println("OWWWWW!"); break; case "In": System.out.println("DDd"); break; } } } Why it cannot run and said that it has 3 error? ..\Playground\:9: error: : expected case "In": ^ ..\Playground\:9: error: illegal character: '\u00bc' case "In": ^ ..\Playground\:10: error: ';' expected System.out.println("DDd"); Thanks

18th Feb 2017, 1:54 AM
freedom
2 Answers
0
problem solved: public class Program{ public static void main(String[] args) { String opp ="Out"; switch(opp) { case "Out" : System.out.println("OWWWWW!"); break; case "In": System.out.println("DDd"); break; } } }
18th Feb 2017, 2:02 AM
Abdelaziz Abubaker
Abdelaziz Abubaker - avatar
0
You have a wrong encoding colon character after "In". Replace it will produce correct answer.
18th Feb 2017, 4:38 AM
Jian-hua Yeh
Jian-hua Yeh - avatar