【发布时间】:2016-05-02 02:44:14
【问题描述】:
我在 arraylist 中存储了 13 个对象,但如果打印 arraylist,那么它显示数组的地址为 [com.psl.beans.Student@e83912, com.psl.beans.Student@1fae3c6,com.psl.beans.Student@7ffe01, com.psl.beans.Student@fd13b5,com.psl.beans.Student@118f375 , com.psl.beans.Student@117a8bd,com.psl.beans.Student@471e30, com.psl.beans.Student@10ef90c,com.psl.beans.Student@a32b, com.psl.beans.Student@1d8957f ,com.psl.beans.Student@3ee284, com.psl.beans.Student@8965fb,com.psl.beans.Student@867e89]
但我想在打印列表时查看该列表中对象的内容,所以有什么办法可以做到这一点..
【问题讨论】:
-
将
toString()方法添加到com.psl.Student类
标签: java spring arraylist collections