jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes toString method in vector. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "toString method in vector." Watch "toString method in vector." New topic

toString method in vector.

Kelly Frasure

Joined: Mar 03, 2001
Posts: 15
I would like to add a toString method to print out all of the elements in the vector. The code will not compile. This is my code. I don't understand why I'm getting this error. The problem is in the AccountList program.


A:\BankProgram\AccountList.java:43: cannot resolve symbol
symbol : variable AcctRoster
location: class AccountList
return AcctRoster;
1 error

[This message has been edited by Kelly Frasure (edited July 22, 2001).]
(edited by Cindy to format code)

[This message has been edited by Cindy Glass (edited July 23, 2001).]
Art Metzer
Ranch Hand

Joined: Oct 31, 2000
Posts: 241
Hi, Kelly.
The problem is, AcctRoster only has scope within the constructor.
Make this Vector an instance variable instead, and try it again.
Good luck,
I agree. Here's the link: http://aspose.com/file-tools
subject: toString method in vector.
It's not a secret anymore!