This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
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

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
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\ 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:
subject: toString method in vector.
It's not a secret anymore!