Scanner s = new Scanner(System.in); int choice = 0; if(s.hasNextInt()) { choice = s.nextInt(); } s.close();//关闭scanner 相关文章: 2021-11-29 2021-11-29 2021-11-29 2022-02-10 2022-12-23 2021-04-30 2021-07-21 2021-11-29