public class Hello{ public static void main(String[] args){ java.util.Scanner sc = new java.util.Scanner(System.in); System.out.println("请输入年龄..."); try{ int age = sc.nextInt(); if(age > 100){ throw new Exception("年龄超过100岁了。。"); } }catch(Exception e){ System.out.println("年龄超过100岁了。。"); } } }