为什么只有以下工作?
char [] indeed = new char []{'a','b'};
System.out.println(indeed);// ehy it's seems like toString has been overridden!
而其他所有代码似乎都没有覆盖它们的toString。
int [] indeed = new int []{3,3};
System.out.println(indeed); // does not work
有人知道它为什么这样工作吗?
最佳答案
http://docs.oracle.com/javase/6/docs/api/java/io/PrintStream.html#println%28char[]%29
class PrintStream
public void println(char x[])
:)
试试这些
System.out.println(indeed.toString());
System.out.println((Object)indeed);