public class mock { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("请输入一个整数:"); int num = scanner.nextInt(); System.out.println("你输入的整数是:" + num); } }
时间: 2023-05-28 10:03:37 浏览: 93
该程序有语法错误,缺少加号连接字符串。
正确代码:
public class mock {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("请输入一个整数:");
int num = scanner.nextInt();
System.out.println("你输入的整数是:" + num);
}
}
阅读全文