• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

cannot find symbol error -- can't see what I'm missing

 
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's been a while since I've been here. I'm working on my program to organize my CD collection, and the class I'm working on right now won't compile because of a 'cannot find symbol error.'

Here's the code. It takes in the various fields for each CD and then is supposed to print the list of entries, added to an array list:


Here's the code for the CD class, which sets the values for the four fields of each CD;



And here's the code for a new class I created called CDstart which contains the main method. Before, the main method contained all the code to input the information. I created this class after looking at the dot com game in chapter 6 of HFJ:




I managed to get all the other error messages fixed, and this is the only one that I keep getting:

CDInputTestDrive.java:105: cannot find symbol
symbol : method printout()
location: class java.util.ArrayList<CD>
CDRecord.printout();


I can't see what I'm doing wrong here. I tried changing it to CD.printout(), but the message is still the same. When I tried to compile CDstart.java, I got the same error message Can someone help me out? The answer, I think, is on the tip of my tounge, but I'm not getting it.
I'll kick myself if it's something elementary, which is quite possible because I've been away from programming for a bit. So my apologies an advance.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
CDRecord is an instance of ArrayList (That is bad naming convention by the way. It should be cdRecord)
ArrayList does not have a printout() method. In your code, the printout() method belongs to CDInputTestDrive. Since you are invoking the printout from inside CDInputTestDrive, you need to change the call to this.printout()
 
Bartender
Posts: 1849
15
Eclipse IDE Spring VI Editor Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
welcome back, Chris!
 
I found some pretty shells, some sea glass and this lovely tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic