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

Matijs Lode
Matijs Lode
775 Points

I don't get it! I did everything and it says error 1

Please help!

PictureBook.java
public class PictureBook {
  public String mTitle() {

  }
}

3 Answers

Jon Kussmann
PLUS
Jon Kussmann
Courses Plus Student 7,254 Points

Hi 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
Ryan Ruscett
23,309 Points

haha that always happens. Typing a response and someone is too!

Jon Kussmann
Jon Kussmann
Courses Plus Student 7,254 Points

Haha, it does happen pretty often. I do like the detail you added to yours!

Ryan Ruscett
Ryan Ruscett
23,309 Points

Hey,

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
Matijs Lode
775 Points

Thank you! :) And thank for explanation

Make 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