码迷,mamicode.com
首页 > 编程语言 > 详细

Effective Java 英文 第二版 读书笔记 Item 10:Always override toString

时间:2016-06-08 15:54:16      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:

for example,PhoneNumber@163b91  class name+@+unsigned hexadecimal representation of hashcode.

define: a concise but informative representation that is easy for a person to read

providing a good toString implementation makes your class much more pleasant to use.

 

when practical,the toString method should return all of the interesting information contained in the object

 

whether or not you decide to specify the format,you should clearly document your intentions.

 

for example:

技术分享

provide programmatic access to all of the information contained in the value returned by toString.

总体感觉:需要利用toString 来描述对象时候才重载,感觉应用机会比较少

Effective Java 英文 第二版 读书笔记 Item 10:Always override toString

标签:

原文地址:http://www.cnblogs.com/linkarl/p/5568105.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!