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 trialAlex Beeler
12,066 PointsSong 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
Lauren Moineau
9,483 PointsHi. 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 :)