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 trialMUZ140891 Stuart Moyo
680 PointsHow do I declare the public String variable mTitle, apparently ma messing up the code
I declare the class PictureBook, no problem... the next step in the challenge is messing with my head. This is the 5th syntax I have tried
public class PictureBook{
public String mTitle("");
}
2 Answers
Logan R
22,989 PointsYou're super close! It should be like this:
public class PictureBook{
public String mTitle = "";
}
When you declare a variable, you want to set it equal to something. Right now you are declaring a variable named mTitle("")
.
Seth Kroger
56,413 Pointspublic String mTitle;
(You're just declaring it, so it doesn't need a value yet. Just a type and a name.)
MUZ140891 Stuart Moyo
680 Pointsthat didnt work before... will give it another shot
MUZ140891 Stuart Moyo
680 PointsMUZ140891 Stuart Moyo
680 Pointsthanks