通过在Java中打印对象获得的信息的含义是什么?

编程入门 行业动态 更新时间:2024-10-23 21:28:21
本文介绍了通过在Java中打印对象获得的信息的含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Integer [] a = new Integer [5]; System.Out.println(((Object)a).toString());

输出得到的是

[Integer @ 89fbe3

89fbe3的含义是什么?这是一种什么样的地址?哈希码?每个对象都是独一无二的吗? ,如果是这样 - 如果它是一个多线程程序,它仍然是唯一的吗?

谢谢!

解决方案

这是对象的内存地址,这是默认的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@89fbe3

what 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中打印对象获得的信息的含义是什么?

本文发布于:2023-08-01 09:22:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1267215.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:含义   对象   信息   Java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!