File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes cannot find symbol error -- can't see what I'm missing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "cannot find symbol error -- can Watch "cannot find symbol error -- can New topic

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

Christopher Laurenzano
Ranch Hand

Joined: Jul 25, 2009
Posts: 104
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: cannot find symbol
symbol : method printout()
location: class java.util.ArrayList<CD>

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, 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.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10825

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()

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1789

welcome back, Chris!

When you do things right, people won't be sure you've done anything at all.
I agree. Here's the link:
subject: cannot find symbol error -- can't see what I'm missing
jQuery in Action, 3rd edition