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 trialRyan Chadha
1,232 PointsI can't understand what's wrong with my code here?
public class PictureBook {
public String mTitle (){
}
}
2 Answers
Steve Hunter
57,712 PointsHi Ryan,
You want to declare a variable:
public class PictureBook {
public String mTitle;
}
If you add the brackets and braces, you've created a method.
Stve.
Krzysztof Kucharzyk
Front End Web Development Techdegree Student 4,005 PointsYou just need to create a string variable named mTitle
public class PictureBook {
public String mTitle;
}
Ryan Chadha
1,232 PointsThanks a lot Krys!
Ryan Chadha
1,232 PointsRyan Chadha
1,232 PointsThanks Steve! I spent so much time on this, not being able to figure out what I was doing wrong,
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsNo problem - glad you got sorted.
Steve.