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 trialQuinton Rivera
5,177 PointsWhats the difference between using system.out and the console print
Whats the difference between using system.out and the console print,
Second does console.printf and system.out.format do the same exact thing how do you know which one to use.
2 Answers
Dennis Addo
Courses Plus Student 2,943 PointsSystem.out.printf or println() is used to print something to the console or normal System output. Console.printf() is a formatted String to the console. In case of Console.printf() when your program doesn't run on the terminal then it will return "NULL" but with the System.out.printf() or System.out.println() it doesn't. I think who your program runs only on a terminal then Console.printf() will be good for you.
System.out. ::: uses default platform encoding(utf-8 or others), while the Console class output methods use the console encoding.
Dennis Addo
Courses Plus Student 2,943 PointsI hope it helps you to understand