import java.util.*;
public class Test {
public static void main(String[] args) { //此行有错!
int score;
Scanner scanner=new Scanner(System.in);
System.out.println("请问您的成绩是多少?(0-100)");
score=scanner.nextInt();
if ((score>100) || (score<0))
System.out.println("输入错误!");
else if(score>=90)
System.out.println("您的成绩是优");
else if(score>=80)
System.out.println("您的成绩是良!");
else if(score>=60)
System.out.println("您的成绩是及格!");
else
System.out.println("您的成绩是不及格,必须补考!");
}
}
错误:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
String cannot be resolved to a type
Scanner cannot be resolved to a type
Scanner cannot be resolved to a type
System cannot be resolved to a variable
System cannot be resolved
System cannot be resolved
System cannot be resolved
System cannot be resolved
System cannot be resolved
System cannot be resolved
at Test.main(Test.java:4)
程序没问题,Unresolved compilation problems。应该是编译环境有问题。你百度下
在我的电脑上跑了你的程序,完全没问题,可能确实是环境的问题
你用到的Scanner,String,等这些类没导包,或者是你不小心吧原来这些类对应的jar包移动了位置,看看你的classpath环境变量的值再去对应的路径下看看有没有这些类对应的包
类似的错误哎。http://blog.csdn.net/chl033/article/details/4744601
代码没有问题,你检查一下编译环境吧,JDK
代码没问题。编译环境的JDK的问题。