I’ve been casually programming in Java for a while, but I still have a few burning questions on the fundamentals. I’ve heard that I should use System.out.println() to display data from some people, and others have given me different ideas (like PrintStream or something else). What’s the best way to print to console in Java?
Share
System.outis a PrintStream.If your main goal is to interact with a console, look at
java.io.Console. If your main goal is to have some kind of logging, use a logging framework like the Java Logging API or log4j.