Arrays和Collections为我们封装了一些针对数组和集合的公共方法,比如常用的类型转换等
Arrays
int[] arr = {
1,2,3,4} ;
String s= Arrays.toString(arr) ;
System.out.println(s);
结果:[1, 2, 3, 4]
自定义对象型数组需要重写tiString方法
Person[] p = new Person[2] ;
p[0] = new Person() ;
p[1] = new Person();
String s1