运行下面一段程序:- public class AssertionExample {
- public static void main(String[] args) {
- int age=Integer.parseInt(args[0]);
- System.out.println("您输入的数字:"+age);
-
- assert age>0: "输入年龄有误!";
-
- System.out.println("您的实际年龄是:"+age+"岁——祝您健康长寿!");
- }
- }
复制代码 后出现
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at AssertionExample.main(AssertionExample.java:4)
哪位朋友指点一下到底是哪里出问题了啊? 速度啊!!!! |