Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Local Development Environments Advanced Tooling Code Generation

Song Request

I created the new class for Song Request from the model, but when typing out the Private String mSingerName; and Private Song mSong; it states that I need to make them type parameters and it wants to take away the semicolon from them. If I ignore this and generate them, it gives me this: public class SongRequest { Private String mSingerName; Private Song mSong;

public SongRequest(Private string, Private song) {
    String = string;
    Song = song;
}

What am I doing wrong? I'm on a Windows 7 OS.

1 Answer

Hi. I will insert your full code here so it's easier to read:

public class SongRequest {
   Private String mSingerName;       
   Private Song mSong;                  

   public SongRequest(Private string, Private song) {
       String = string;                           
       Song = song;                             
   }
}

You have a typo. It should be private (all lowercase), not Private. You got the error because of that typo and it then generated a wrong constructor because it saw Private as an object.

If you correct it, you should get your correct constructor:

 public SongRequest(String singerName, Song song) {
       mSingerName = singerName;                           
       mSong = song;                             
   }

Hope that helps :)