Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trouble printing objects contents through ArrayList

 
David Laverdy
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




I've tried just about everything I know to get the array to NOT print the location of the object and it's contents. I have overridden the toString() method for each object and I still get nothing back. Help is appreciated Thanks
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Laverdy wrote:I have overridden the toString() method for each object

Not in the code you've posted you haven't.
 
David Laverdy
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought I did. Shouldnt showData() work ?
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Laverdy wrote:I thought I did. Shouldnt showData() work ?

If you call showData, then that will work, but you are calling toString. An overriding method has to have the same signature (including the name) as the method it is overriding.
 
David Laverdy
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks I did a toString() method and I got the output I needed thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic