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

Java Java Objects (Retired) Creating the MVP Remaining Characters

Ethan Thorne
Ethan Thorne
704 Points

Stuck on step 2 of the Challenge!

Just want to express my appreciation for these Java tutorials, and of course to you Craig for putting in the effort to help us newbies. :D

Just as the title explains, I'm stumped and have no idea where to start, a nudge in the right direction would be appreciated!

Cheers.

1 Answer

Brendan Whiting
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,735 Points

So you're defining a new method. It's going to be similar to the method that's already in there, "getText()".

You'll need to start with a keyword for if it's public or private, then a keyword for the return value, then the name of the method followed by a couple parentheses. Then inside a set of curly braces, you'll write some code to have it calculate and return the number of remaining characters available for the tweet. So you'll use the new constant you made in Step 1, and you'll use a method that you can google for finding the number of characters in a string, and you can call that method on the variable that holds the tweet so far.