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

david vos
david vos
1,479 Points

i do not understand this question. I've tried everything and it is always giving syntax errors

please help

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

2 Answers

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there! You're doing fine, and your syntax is spot on, but you're trying to overwrite the value in answerToLife which was already declared. This will give a syntax error. The variable you make should simply be named answer. So if on the second line I change it from int answerToLife to int answer, your code passes the challenge!

Hope this helps! :sparkles: