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 Objects (Retired) Creating the MVP Prompting for Guesses

Why does he declare the variable "console"

Why does he have to declare the console variable in the prompt method to use conslole.readLine(); while in earlier videos he used console.readLine(); without declaring the console variable ???

1 Answer

Tomas Smalakys
Tomas Smalakys
4,666 Points

I believe it was like this because the teacher did not want to confuse you with too much information. In the first stages of the Java programming, the console class was declared, but the user (You), have not been notified about this. Lately, when you got more familiar with Java, as programming language and had an understanding of objects, the teacher introduced you to the import.