本文介绍了通过在Java中打印对象获得的信息的含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Integer [] a = new Integer [5]; System.Out.println(((Object)a).toString());
输出得到的是
[Integer @ 89fbe389fbe3的含义是什么?这是一种什么样的地址?哈希码?每个对象都是独一无二的吗? ,如果是这样 - 如果它是一个多线程程序,它仍然是唯一的吗?
谢谢!
解决方案这是对象的内存地址,这是默认的toString()在Object类中实现的内存地址。它也是默认的hashCode()。
Lets say i have this code :
Integer[] a= new Integer[5]; System.Out.println(((Object)a).toString());the output is get is
[Integer@89fbe3what is the meaning of 89fbe3 ? is this some kind of address ? hash code? is it unique for each object? , and if so- if its a multi-threaded program , is it still unique ?
thanks !
解决方案It's the memory address of the object which is what the default toString() implemented in the Object class does. It is also the default hashCode().
更多推荐
通过在Java中打印对象获得的信息的含义是什么?
发布评论