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 Using your New Tools Multiple Format Strings

Compiler error with declaring variable

There seems to be something wrong with this code when checking my work. I have ran it in workspace and it works no problem.

Could someone please explain to me where I have went wrong?

Multiple.java
// I've imported java.io.Console for you.  It is stored in a variable called console for you.
String name = console.readLine();

2 Answers

Hi Stephen!

I assume that you are in task one, if you are not then please let me know.

I looked at your code and it was correct. I was confused too why it was not working. All you need to do is put in some text like so:

String name = console.readLine("What is your name?");

Hope this helped!

If this does not work or you are not on task one please let me know.

Thanks! :)

Yes that is the task I am on. I have just added in the text and it worked!

Thank you very much for your help. I did find it confusing as it didn't mention adding text.

Yes I know, that was really weird. :)