This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Trouble printing objects contents through ArrayList
David Laverdy
Greenhorn
Joined: Aug 14, 2011
Posts: 17
posted
0
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
Joined: Aug 05, 2005
Posts: 3011
9
posted
0
David Laverdy wrote:I have overridden the toString() method for each object
Not in the code you've posted you haven't.
Joanne
David Laverdy
Greenhorn
Joined: Aug 14, 2011
Posts: 17
posted
0
I thought I did. Shouldnt showData() work ?
Joanne Neal
Rancher
Joined: Aug 05, 2005
Posts: 3011
9
posted
0
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
Joined: Aug 14, 2011
Posts: 17
posted
0
Thanks I did a toString() method and I got the output I needed thanks!