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

Hannah Mishow
Hannah Mishow
1,136 Points

Problem With Challenge in Build Simple Android App "Add a String member variable named mTitle. Make it public."

Error keeps saying ';' expected where the second curly bracket is but every time I add it, its wrong and I get no info in the preview

PictureBook.java
public class PictureBook {
public String mtitle}

3 Answers

Hi Hannah,

Your code appears to be missing a semi-colon at the end of your variable declaration. You need to end each line with a semi-colon, and then the end of your class with a curly brace. You should see something like this:

public class MyClass {
   public string mMemberVariable;
}

I hope this helps solve your problem. Happy coding!

Mohit Kishore
Mohit Kishore
13,935 Points

I like your answer more than my own : O You didn't give the answer but you gave a solution : ) An up vote for that : )

Mohit Kishore
Mohit Kishore
13,935 Points

In Java every statement must end with a ";" And a block of code in a "{}" So your solution is <code> public class PictureBook{

    public string mTitle;

} </code>

the statement in your class must end with a semicolon. thats where the error is emanating from:

public String mTitle;

hope this solves it