JAVA遍历list得到一组object,如何得到object中的值

nickrylai 2016-05-05 02:27:30


for(int i = 0; i < typelist.size(); i++){
System.out.println(typelist.get(i));
//for(Object obj : typelist.get(i)) 错误:can not cast to
//Iterator it = (Iterator) typelist.get(i);
while(it.hashnext){
System.out.println(it.next);错误:can not cast to
}
}

for循环该list,System.out.println(typelist.get(i));输出得到[Ljava.lang.Object;@53da155c

...全文
2445 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
nickrylai 2016-05-05
  • 打赏
  • 举报
回复
nickrylai 2016-05-05
  • 打赏
  • 举报
回复
引用 1 楼 Jintao_Ma 的回复:
你的Object存放的是类, 在类中加上toString方法就可以了。
谢谢你的回答,我找到方法了,为了做个结贴的好孩子,把分给你吧
Jintao_Ma 2016-05-05
  • 打赏
  • 举报
回复
你的Object存放的是类, 在类中加上toString方法就可以了。

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧