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 - Retired Efficiency! Implement Chooser UI

3 compile errors I can't find.

Hi. I have spent hours trying to figure out where my 3 mistakes are. I keep reviewing the video frame by frame to ensure I've entered everything as Craig has. These are probably very easy to find for an experienced person. In addition to helping with the errors, If there are pointers someone can share on how to parse the error messages to make them easier to trace to the cause, I would greatly appreciate that. I'm spending hours looking for typos instead of hours learning and practicing java.

Below is a snapshot of my work space, and a copy of my 3 errors

ERRORS Picked up JAVA_TOOL_OPTIONS: -Xmx128m
Picked up _JAVA_OPTIONS: -Xmx128m
./com/teamtreehouse/KaraokeMachine.java:94: error: ';' expected
songTitles.add(song.getTitle)();
^
./com/teamtreehouse/KaraokeMachine.java:55: error: method promptSongForArtist in class KaraokeMachine cannot be applied to given types;
Song artistSong = promptSongForArtist();
^
required: String
found: no arguments
reason: actual and formal argument lists differ in length
./com/teamtreehouse/KaraokeMachine.java:94: error: cannot find symbol
songTitles.add(song.getTitle)();
^
symbol: variable getTitle
location: variable song of type Song
3 errors
workspace
https://w.trhou.se/4ed1ix6ms1

1 Answer

Kristi Marks
Kristi Marks
1,807 Points

On Line 94 you only need one set of parenthesis to call song.getTitle() like:

songTitles.add(song.getTitle());

Make sure you either

  1. Put the calls to your prompt methods in try blocks and catch the exception
  2. Make sure your run method also bubbles those exceptions up(IE throws IOException)

Also, promptSongForArtist expects a String to be passed in and on line 55 you call it without passing artist in.

String artist = promptArtist();
Song artistSong = promptSongForArtist(artist);