这是代码
import java.io.*;
public class Score2 {
public static void main(String args[])throws IOException
{
BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Please input s=");
String str=input.readLine();
int s=Integer.parseInt(str);
int flag=s/10;
System.out.println(flag);
swtich(flag)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:System.out.println("不及格");break;
case 7:System.out.println("及格");break;
case 8:System.out.println("中");break;
case 9:System.out.println("良");break;
case 10:System.out.println("优");break;
default:System.out.println("Error!");break;
}
}
}
这是显示的错误
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Syntax error on tokens, Label expected instead
Syntax error on token "case", assert expected
Syntax error on token "case", assert expected
Syntax error on token "case", assert expected
Syntax error on token "case", assert expected
Syntax error on token "default", invalid Label
Syntax error on token "}", delete this token
at Score2.main(Score2.java:12)