import java.util.*; public class Main{ public static void main(String args[]) { Scanner cn = new Scanner(System.in); System.out.print("请输入一个整数:"); int data; if (cn.hasNextInt()) { data = cn.nextInt(); System.out.println("输出:"); System.out.println(data); } else { System.out.println("输入有问题。。。"); } }}