Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java

Anony Mous
Anony Mous
563 Points

Console.printf

Hello. Why doesnt Console.printf work in my IDE but System.out.println works perfectly fine?????

There is a good thread from 2015 that covers this question:

https://teamtreehouse.com/community/difference-between-systemoutprintf-and-systemoutprintln

Vladut Astalos
Vladut Astalos
11,246 Points

Hi! I think you first need to import java.io.Console and then create an object of type Console and call printf() method on that object, something like: Console console; console.printf("...your output...");

1 Answer

Jordan Powell
PLUS
Jordan Powell
Courses Plus Student 5,410 Points

Console.printf requires you to import is from the java library then create an sintance of the console object and then you can use the console.printf however just get used to using System.out.printf because it's a static call it can be used without creating and instance of the object.