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 trialMatijs Lode
775 PointsI don't get it! I did everything and it says error 1
Please help!
public class PictureBook {
public String mTitle() {
}
}
3 Answers
Jon Kussmann
Courses Plus Student 7,254 PointsHi Matijs,
It looks like you created a method called mTitle. The question is asking you to declare a member variable (that is a String) called mTitle.
To do so looks like this:
public String mTitle;
I hope this helps, if not please let me know.
Ryan Ruscett
23,309 PointsHey,
You are so close. When defining a variable. You do not use (). Remove those from the mTitle and don't forget to end the statement with a semicolon. mTitle;
Really the only time you use {} those type of brackets for creating classes and methods. You already have a class called PictureBook and there is no inner class in this example. Take a look at the example below.
That's how it should look. Class with one member variable.
public class PictureBook {
public String mTitle;
}
Let me know if that solves your problem or if I can help more.
Matijs Lode
775 PointsThank you! :) And thank for explanation
Geraldine Tanaka Munyoro
5,170 PointsMake sure you are declaring a member variable in the class named 'title'.
thats the error I keep getting even after i have declared the member variable
Matijs Lode
775 PointsThank you Jon! :)
Ryan Ruscett
23,309 PointsRyan Ruscett
23,309 Pointshaha that always happens. Typing a response and someone is too!
Jon Kussmann
Courses Plus Student 7,254 PointsJon Kussmann
Courses Plus Student 7,254 PointsHaha, it does happen pretty often. I do like the detail you added to yours!