当我们在main方法中打印新的int [] {2}时,我们将得到哈希码[I @ 138a55?int数组是否会覆盖hashcode?是因为new int []自动框是Integer []吗?什么原因?
[I是getClass().getName ()在执行时的输出int[].另一方面,因为Integer[],你会[Ljava.lang.Integer;在打电话时得到getClass().getName ().
int[]数组不会自动装箱Integer[].
[I@138a55不是数组的哈希码,只有138a55部分是数组哈希码的十六进制表示.
int数组不会覆盖Object's 的默认实现hashCode().
| 归档时间: |
|
| 查看次数: |
180 次 |
| 最近记录: |