- String[] d = new String[]{"a","b","c"};
-
- //Arrays转换为list输出abc
- System.out.println(Arrays.asList(d));//[a, b, c]
- System.out.println(Arrays.asList(d).get(0));// a
- System.out.println(Arrays.asList(d).get(1));// b
- System.out.println(Arrays.asList(d).get(2));// c
- //toString的同学要注意下,丙不能取出单个的,看下api源码就可以了
- System.out.println(Arrays.toString(d));//[a, b, c]
- System.out.println(Arrays.toString(d).charAt(0));//[
- System.out.println(Arrays.toString(d).charAt(1));//a
- System.out.println(Arrays.toString(d).charAt(2));//,
-
- //反射reflect.Array
- System.out.println( Array.get(d, 0));//a
- System.out.println( Array.get(d, 1));//b
- System.out.println( Array.get(d, 2));//b
复制代码 |