这是我遇到的错误
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Scanner cannot be resolved to a type
Scanner cannot be resolved to a type
at hello.main(hello.java:11)
这是我的代码。
public class hello {
public static void main(String[] args) {
// TODO Auto-generated method stub
double area;
double radius;
Scanner input = new Scanner(System.in);
System.out.print("반지름을 입력하시오: ");
radius = input.nextDouble();
area = 3.14 * radius * radius;
System.out.println(area);
}
}
答案 0 :(得分:0)
您是否导入了类似import java.util.Scanner;
答案 1 :(得分:0)
你需要:
import java.util.Scanner;
位于文件顶部。你必须导入它。