• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

toString method in vector.

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
There's a way to do it better - find it. -Edison. A better tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic