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 Introduction to Your Tools

can you explain why i have to use console.printf instead of system.out.println?

well,i saw a hello world program in a book where they used system.out.println instead of console.printf.so i am really confused about this matter.

2 Answers

6,709 Points

I also had this problem when I first watched this video. I stumbled upon this answer here to clear things up: https://teamtreehouse.com/community/what-is-the-difference-between-systemoutprint-and-consoleprintf

Craig Dennis explains some differences here: https://teamtreehouse.com/community/is-consoleprintf-good-practice

I think most books use System.out.printf or System.out.println because it can be used universally across different applications. Say if you're building an web app using Spring, you can use System.out to print outputs for your debugging.