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 trialCourtney Knight
807 PointsI am not sure of what I am missing from this. It keeps telling me I have t make it public then it says compiler issue
I am not sure of what I am missing from this... it keeps to me I need to make it public so I made: public final static String mTweet;
now it is saying I have a compiler issue
public class Tweet {
public final static int MAX_CHARACTER_LIMIT = 140;
public final static String tweet;
private String mTweet;
public Tweet(String tweet){
mTweet = tweet;
}
public String getTweet() {
return mTweet;
}
}
1 Answer
Rob Bridges
Full Stack JavaScript Techdegree Graduate 35,467 PointsHey there, in the first challenge they are just asking you to create the final variable MAX_CHARACTER_LIMIT which you correctly set and made final to 140.
You don't need to create another variable for String Tweet and set it final. Just the Max Character Limit.
The next task will aks you to make a method to return how many chars are left based on the length of mText. However in all your code should look a bit like below.
public class Tweet {
private String mText;
public final static int MAX_CHARACTER_LIMIT = 140;
public Tweet(String text) {
mText = text;
}
public String getText() {
return mText;
}
public int remainingChars() {
int remainingChars = MAX_CHARACTER_LIMIT - mText.length();
return remainingChars;
}
}
Thanks.