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

Getting an error.

I'm getting this error with a ^ over the a in answerTolife. Any suggestions? Thanks.

ParsingInts.java
int answer = Integer.parseInt(answerToLife);
Chris Shaw
Chris Shaw
26,676 Points

Hi michaelconnolly,

Try the challenge again as I just tried your code and it worked fine.

2 Answers

Axel McCode
Axel McCode
13,869 Points

Hi Michael! Your code doesn't seem to have any errors. My guess is that you have deleted the line of code above the line of code you have posted above. Here are the two lines of code I used for this challenge. I have tested them and they work. Hope this helps :)

String answerToLife = "42";
int answer = Integer.parseInt(answerToLife);

Thanks, I got it working. Thanks again.