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 Strings

console.readLine

Why do I need to use System.console().readLine(); in sublime text but in work spaces we dont use System

3 Answers

andren
andren
28,558 Points

In the workspace they instantiate the console for you using this line:

Console console = System.console();

That makes it so console is set to System.console(). If you include that line for yourself at at the top of your class in sublime then you should be able to just use console.readLine() as well.

Darn it. Answered at the same time.

Your answer is better :trophy:

andren
andren
28,558 Points

Nah I'd say our answers are about equal. But we do really have a tendency to answer around the same time don't we :smile:.

No I meant to say for this question.

Sorry Jordan for getting a little off-topic Lol

This is because Craig did this in his file:

Console console = System.console();

Craig will tell you how this works in a later video :grin:

~Alex

Thank you!