Arrays工具类的使用
java.util.Arrays
-
boolean equals (int[] a,int[] b) 判断两个数组是否相等
-
String toString(int[] a) 输出数组信息
-
void fill(int[] a,int val) 将指定值填充到数组中(全部替换)
-
void sort(int[] a) 排序(从小到大)底层为快排
-
int binarySearch (int[] a,int key) 二分查找,返回负数表示没找到
数组中常见的异常
-
数组角标越界 ArrayIndexOutOfBoundsException
-
空指针异常 NullPointerException
(1)int[] a = new int[3]; a = null;
(2)int
(3)String str[] = new String []{null,"BB",CC};str[0].toString();