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

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.