本帖最后由 李志卫 于 2013-3-5 02:23 编辑
特别优待
看下面代码,你会发现char[]数组并没有重写toString方法- class Test14
- {
- public static void main(String[] args)
- {
- String s = "abc";
- byte[] b = s.getBytes();
- System.out.println(b.toString());
- System.out.println(new String(b));
- char[] arr = {'a','b','c','d','e'};
- System.out.println(arr);
- System.out.println(arr.toString()); // 结果是 [C@1fc4bec
- int [] arr1 = {1,2,3,4,5};
- System.out.println(arr1.toString());
- }
- }
复制代码 |