Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Java Objects Creating the MVP Remaining Characters

michael lee
michael lee
5,179 Points

What am I missing?

I don't understand what am I missing here?

Tweet.java
public class Tweet {
  private String text;
  static final int MAX_CHARS;

  public Tweet(String text) {
    this.text = text;
  }

  public String getText() {
    return text;
  }

  public void setText(String text) {
    this.text = text;
  }
}

1 Answer

hi, for the first challnage u need to declare MAX_CHARS and assign him to 140. and in the second challnage u need to create a method that gets the remaining chars available based on the text variable. the working code is this :

public static final int MAX_CHARS = 140

u need to set it to public because u want to get access to this variable outside of the class and set it to final, final prevent u to change the variable and lastly u need to set the value to 140.