Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Data Structures Efficiency! Building the Model

Christopher Mlalazi
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,305 Points

One error

I have one error in Karaoke.java that I just can't figure out. Hopefully someone can assist so that I can go forward. Here is the console error:

Karaoke.java:14: error: cannot find symbol                          
    System.out.printf("There are %d songs. %n", songBook.getSongCoun
t());                                                               
                                                        ^           
  symbol:   method getSongCount()                                   
  location: variable songBook of type SongBook                      
1 error 

And this is my code:

https://w.trhou.se/z5wrcoske6

3 Answers

There's a typo in your SongBook class. The method is named getSingCount() instead of getSongCount().

Christopher Mlalazi
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,305 Points

Wow I must be dreaming of singing :) Thanks Livia, I was looking in the wrong file the compile error was pointing at Karaoke while the error is in SongBook how come?

From the compiler's point of view, the problem IS in Karaoke, because that's where you're trying to call a method that doesn't exist. The method getSingCount() is fine by itself, it has proper syntax and all. You could correct the Karaoke class instead to call getSingCount() and it'd work. Of course you meant to write getSongCount() so you'd rather correct the SongBook class than the Karaoke class, but the compiler doesn't know that.