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

Austin McKenzie
PLUS
Austin McKenzie
Courses Plus Student 1,745 Points

I am having issues with the second task of Improving Our Code

I have this so far but cannot understand where I am going wrong?

public class PictureBook { public String mTitle() { }
}

1 Answer

Gard Mikael Fjeldavli
Gard Mikael Fjeldavli
19,416 Points

You are confusing variables and methods. A method has parentheses after its name to take in arguments like this method(var1, var2).

In this assignment, on the other hand, you are asked to create a variable. You do that be specifying the datatype followed by the variable name (you can also assign a value to that variable at the same time, but you are not required to in this task). Finally you end the sentence with a semi-colon (;) Hope this helps!

public class PictureBook { 
     public String mTitle;
}