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 Basics Perfecting the Prototype Parsing Integers

Braedon Angel
Braedon Angel
9,946 Points

what am i doing wrong?

i've watched the video 20 times and still cant figure this out!!! Please Help

ParsingInts.java
String answerToLife = "answerToLife";

1 Answer

Steven Parker
Steven Parker
231,271 Points

You won't need to change anything on the line they give you to start with. The instructions say to "*Create a new int variable…", so you will do this on the next line. It will be an int instead of a String, and they tell you it should be "named answer".

Finally, they tell you to "Store the integer version of answerToLife in it", so you will convert the string created on the first line into a number, which can be done with the Integer.parseInt method.

There's an example of this being done for someone's age in this part of the Parsing Integers video.