如图,直接打印String ,int类型的数组名,会得到地址值
而直接打印char类型的数组会得到字符连起来的字符串
直接打印List,Set,Map等集合,还有Properties时得到的不是地址值,而是集合内容
想要直接打印出数组名,可以使用Arrays.toString
System.out.println(array);//不能打印出数组的内容 [Ljava.lang.String;@67f639d3
System.out.println(Arrays.toString(array));//[AAA, BBB, CCC]
System.out.println(list);//[AAA, BBB, CCC]
System.out.println(set);//[AAA, BBB, CCC]
System.out.println(map);//{test1=AAA, test2=BBB, test3=CCC}
System.out.println(pro);//{test4=DDD, test5=EEE}