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 trial

Android Build a Simple Android App (2014) Improving Our Code Creating a Class

How 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

PictureBook.java
public class PictureBook{
  public String mTitle("");
}

2 Answers

Logan R
Logan R
22,989 Points

You'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("").

thanks

Seth Kroger
Seth Kroger
56,413 Points

public String mTitle;

(You're just declaring it, so it doesn't need a value yet. Just a type and a name.)

that didnt work before... will give it another shot