File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "toString method in vector." Watch "toString method in vector." New topic
Author

toString method in vector.

Kelly Frasure
Greenhorn

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,
Art
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: toString method in vector.
 
Similar Threads
Just Can't figure it out and it's due today
Bank program class or switch problem
Thread question
Program like ATM where person enters amount in dollars and cents but program uses int for monies
need help urgent please