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 trialAdam Duffield
30,494 PointsProblems with code for the final code challenge on Java Objects
Here is my code... I'm just having issues with thinking that I've got the right code but it's telling me that I'm wrong, I just have to return the length of the text if it's less than 140 characters but I must be missing something.
public class Tweet {
private String mText;
public static final int MAX_TWEETS = 140;
public Tweet(String text) {
mText = text;
}
public String getText() {
return mText;
}
public int doStuff(){
if(mText.length() < MAX_TWEETS){
return mText.length();
}
}
}
1 Answer
Nicolas Hampton
44,638 PointsIt doesn't look like there's an error there at all. Are you sure that's all the question is asking you to do?
Nicolas Hampton
44,638 PointsThat's not what it's asking you to do. It's asking you to return the difference between the MAX_TWEET and the text in mText. You want to subtract mText from MAX_TWEET, then return the result.
Adam Duffield
30,494 Pointshaha! perfect cheers for that comment Nicolas, it's kind of nice to know that I'm all good on the coding side but lacking on my reading skills!
ISAIAH S
1,409 PointsISAIAH S
1,409 PointsWhat's your error?