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

Why aren't there no quote marks for ageAsString inside of Integer.parseInt?

What the title said.

1 Answer

Hi there,

The variable ageAsString is declared in the code. It is a String variable that is used to store the result of the readLine method. So,

String ageAsString = console.readLine("How old are you? ");

asks the user a question and uses readLine to take the user's input. This input is then stored in the variable ageAsString which you will then convert to an int.

I hope that makes sense.

Steve.

So, variable names don't need quote marks around them - they exist in code without those.