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

I'm on Creating a Class. Where is my error in: public class PictureBook { public String mTitle() { } }

the first line passed the challenge. It's the second one that I'm stumbling on.

3 Answers

Luke, I figured it out! Substituted the second { for a semi-colon and I'm off...

Hi!

Your code looks awesome apart from one little thing. Would you usually put a set of parentheses after a variable declaration? Maybe take a look at that and don't forget to add your semi-colon!

I hope that I managed to help you out and don't hesitate to let me know if you are having any further problems with it!

-Luke

Thanks Luke. The set of parentheses were part of the initial instructions, without explanation. So I guess the answer here is "Yes"? I thought adding the semi-colon would then be a simple fix, but I'm still stuck even after this change (and multiple other tries, including elimination of the ()):

public class PictureBook {

public String mTitle() {

}; }

P.S. The only error I'm getting with the code below is:

./PictureBook.java:3: error: ';' expected public String mTitle { ^ 1 error

CHANGED CODE:

public class PictureBook {

public String mTitle {

}; }

If I place the () back into the code, I get this error:

./PictureBook.java:5: error: missing return statement }; ^ 1 error

Aarg. Any ideas Luke?

Joshua marais
Joshua marais
2,955 Points

Hello tri putting a ; at the end of mTitle.