java数组转为字符串_java数组转字符串要如何转换?一般有几种方法?

技术博客 (140) 2023-09-16 16:58:01

数组是java中一个重要的类型,小伙伴们知道如何将数组转为字符串吗?下面就让小编为你介绍一下吧。

在数组中直接用

toString()方法返回的并非常常并非我们想要的字符串,而是[类型@哈希值],其原因在于Object类中的toString方法,如下:/**

* Returns a string representation of the object. In general, the

toString method returns a string that

* "textually represents" this object. The result should

* be a concise but informative representation that is easy for a

* person to read.

* It is recommended that all subclasses override this method.

* The toString method for class Object

* returns a string consisting of the name of the class of which the

* object is an instance, the at-sign character `@', and

* the unsigned hexadecimal representation of the hash code of the

* object. In other words, this method returns a string equal

THE END

发表回复