标签:
这是Arrays工具类的方法:
private static void rangeCheck(int length, int fromIndex, int toIndex) { if (fromIndex > toIndex) { throw new IllegalArgumentException( "fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")"); } if (fromIndex < 0) { throw new ArrayIndexOutOfBoundsException(fromIndex); } if (toIndex > length) { throw new ArrayIndexOutOfBoundsException(toIndex); } }
让外部进行调用,也就是public static void sort(char[] a, int fromIndex, int toIndex)这个方法进行调用,范围检查的调用方式,和数据校验有点像
Java异常【不是很常用自己去设计异常,面试和笔试也基本少问到】
标签:
原文地址:http://www.cnblogs.com/chenxuezhouLearnProgram/p/5743761.html