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

Sam Ford
Sam Ford
2,633 Points

Some messages have been simplified; recompile with -Xdiags:verbose to get full output

I am getting the error

TreeStory.java:16: error: incompatible types: String cannot be converted to boolean
String ageAsString = console.readline("How old are you? ");
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full o utput
1 error

my code looks like this:

String ageAsString = console.readline("How old are you? "); int age = Integer.parseInt(ageAsString); if (age < 13) { //Insert exit code console.printf("Sorry you must be atleast 13 to use this programme.\n"); System.exit(0); }

is there anything wrong!?

1 Answer

Allan Clark
Allan Clark
10,810 Points

Looks like the line needs to be capitalized on your readLine(); method call.