Scanner s = new Scanner(System.in); int choice = 0; if(s.hasNextInt()) { choice = s.nextInt(); } s.close();//关闭scanner
Scanner s = new Scanner(System.in); int choice = 0; if(s.hasNextInt()) { choice = s.nextInt(); } s.close();//关闭scanner
转载于:https://www.cnblogs.com/simplepaul/p/6529374.html