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 Getting Started with Java Strings and Variables

Console??

nobody is using console to print messages. It has always been System.out.println. This is very weird and even misleading. I tried to run the code in a compiler called BlueJ and it is not working. Very strange way of teaching

2 Answers

In the beginning of this course, the consolef is a basic and a convenient alternative to System.out.println. I was also thinking the same as well in the beginning of the course, in the future for example when you get to Object Oriented Programming. The System.out.println will be used more often. There is no need to use System.out.println for now. Also in order to use the printf function, you have to import it. At the very top of the editor (Ex: Eclipse, BlueJ, etc). Type import java.io.Console;

Then below the main class: Console console = System.console();

I felt the same way when I started learning java code. Always pay attention to your import and code from there. You will find multiple ways of handling an issue, just pick the most comfortable and stick to it. Happy coding and toking