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 trialClaudio Chandia
357 PointsCan someone helpme?
Now add a String member variable named mTitle. Make it public.
Bummer! There is a compiler error. Please click on preview to view your syntax errors! Preview Get Help Recheck work PictureBook.java
1 public class PictureBook{ 2 3 public String mTitle() { 4 5 } 6 7}
public class PictureBook{
public String mTitle() {
}
}
3 Answers
Shazad Kazi
10,758 PointsHere's what I got and it worked fine. Let me know if it helps.
public class PictureBook{
public String mTitle;
}
Ken Alger
Treehouse TeacherClaudio;
Welcome to Treehouse!
Your code above is not defining a variable but is instead creating a function. To define a public String variable you just need to follow the format of:
public String variableName;
Post back if you are still stuck.
Ken
T K
1,875 Points./PictureBook.java:2: error: class, interface, or enum expected public String mTitle; ^ 1 error
Its asking for a return value... ??
MUZ140635 Tatenda Mahobele
2,239 PointsNow add a String member variable named mTitle. Make it public.
Bummer! There is a compiler error. Please click on preview to view your syntax errors! Preview Get Help Recheck work PictureBook.java
Claudio Chandia
357 PointsClaudio Chandia
357 PointsI DONT UNDERSTAND WHAT THE PROBLEM IS. DO YOU?