Android Build a Simple Android App with Java Improving Our Code Creating a New Class

Maya Gronkowski
Maya Gronkowski
347 Points

Im not quite sure what im supposed to do here

I dont know what they mean when it says add a string field

PictureBook.java
public class PictureBook 
{
  public String title() 
  {
    return title;
  }
}

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 83,234 Points

Hi there Maya,

It looks like you're creating a new method as a property. But all you need is a public String property with the name of title, so you don't need to return anything.

Try declaring your class in the same way but inside, simply type

public String title;

Which creates the member variable