Arrays.toString()

Arrays.toString()

打印数组的方法,小地方,却老忘记,来自FindBugs的提示:
The code invokes toString on an array, which will generate a fairly useless result such as [C@16f0472. Consider using Arrays.toString to convert the array into a readable String that gives the contents of the array.

Arrays提供一系列接收不同类型数组作为参数的toString方法

String[] array  =   new  String[]{ " a " , " b " , " c " };
System.out.println(Arrays.toString(array));

你可能感兴趣的:(Arrays.toString())