class wrenwren{ public static void main(String args[]) { System.out.println(new wrenwren()); } }
结果是:wrenwren@3e25a5
这是什么意思?
是不是相当于System.out.println((new wrenwren()).toString());
------解决方案--------------------
lz说的很正确。
------解决方案--------------------
对的,在直接输出对象变量时,会调用他们的 toString() 方法。
------解决方案--------------------
wrenwren@3e25a5
前面的wrenwren是对象名,后面的3e25a5是其在内存中的地址