import java.util.*;
class Scanner {
public static void main(){
Scanner sc = new Scanner();
System.out.println("enter a number ");
int a = sc.nextInt();
System.out.println("the number you entered is "+a);
}
}
最佳答案
不建议将类的名称与普通软件包的名称相同,例如Scanner。您应该更改您的类名,错误将消失。
关于java - 程序显示错误 “the method nextInt() is undefined for the type Scanner” : what should i do?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/63804984/