Scanner //创建Scanner对象 Scanner scanner = new Scanner(System.in); //获取键盘录入的int类型的值,next()方法是获取String类型 int a = scanner.nextInt(); //打印 System.out.println("输入的数字是:"+ a);