import java.util.Scanner;
package reviewDistance;
public class ReviewDistance {
public static void main(String[] args) {
int sec1;
int sec2;
int sec3;
int race;
Scanner input = new Scanner(System.in);
System.out.print("Enter the length of the first section of the race in kilometers:");
sec1 = input.nextInt();
System.out.print("Enter the length of the second section of the race in kilometers:");
sec2 = input.nextInt();
System.out.print("Enter the length of the third section of the race in kilometers:");;
sec3 = input.nextInt();
input.close();
race = sec1 + sec2 + sec3;
System.out.println("Length of the race: " + race + "km");
}
}
我收到的错误代码是这个,我不知道为什么!我是Java的新手
线程“main”中的异常java.lang.Error:未解决的编译问题:
at reviewDistance.ReviewDistance.main(ReviewDistance.java:6)
答案 0 :(得分:0)
import java.util.Scanner;
package reviewDistance;
将其更改为
package reviewDistance;
import java.util.Scanner;
包应该是你的jave文件中的第一行