java中toString方法

简而言之:就是返回一个字符串对象,显示的格式为这样子:

getClass().getName() + '@' + Integer.toHexString(hashCode())

 所以在实体类中我们都会重写toString()方法,可以显示一些有意义的东西,例如

 下面这篇有更详细的介绍

 https://blog.csdn.net/ITBigGod/article/details/79290332

原文地址:https://www.cnblogs.com/zmlgoes/p/13376181.html