public class Main { public static void main(String[] args) { try { System.out.println(Tro(-5)); } catch (Exception e) { System.out.println("catched"); throw new IllegalArgumentException(e); } } public static int Tro(int a){ if(a<0){ throw new IllegalArgumentException("参数为负"); } return a; }}
呀