Java Java Basics Getting Started with Java Strings and Variables

Gauseeban Iyathurai
Gauseeban Iyathurai
362 Points

Hi, why not use: System.out.println(""); Instead of console.printf(""); Want that be faster?

Hi, I have been taught that you could print text using: System.out.println("My name is Craig"); Want that be a better way of printing text as opposed to Console console = System.console(); console.printf("My name is Craig"); I did not manage to print text on IntelliJ IDEA by using the console.print method. Why is that? Could you please explain?

1 Answer

Brendon Butler
Brendon Butler
4,233 Points

I think they use console because it integrates well with the workspaces. Intellij doesn't support console (at least not natively). You would have to compile your code and run it externally to get it to run. For the course it's easier to type console.printf(""); than System.out.printf(""); over and over again.

For Intellij you can just use System.out.printf/println(""). And if you type sout and press the tab character on your keyboard it will auto fill to System.out

Said Gaforov
Said Gaforov
809 Points

I was going to ask the same question, looks like you already answered it. I took a java course with Udacity, they used System.out from the very beginning, therefore I was confused here.