jdk1.3+editplus运行结果:
---------- Running with JAVA ----------
47
VarArgs@17e8f5
3.14
11.11
one
two
three
A@17e94b
A@17e94a
A@17e949
Normal Termination
Output completed (2 sec consumed).
---------- Running with JAVA ----------
47
VarArgs@17e8f5
3.14
11.11
one
two
three
A@17e94b
A@17e94a
A@17e949
Normal Termination
Output completed (2 sec consumed).
所以如果对象有值就输出了它的值,47,3.14,11.11,one , two,......
如果对象没有值,只是初始化了,那么输出的是他的地址。
47
VarArgs@310d42
3.14
11.11
one
two
three
A@20c10f
A@62eec8
A@2a9835试了一下,程序应该没什么问题
这里class A是inner class(也翻译成内部类的)
这里main中调用f方法,提供的参数都是object数组
每次输出的是数组的toString()的结果
于是对于Integer,Float,Double,String等输出的均为其初始化时所提供的参数值
对于VarArgs及A则默认输出objectname@hashcode
好,加分!