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 Perfecting the Prototype Conditional ints

Would printing with console object not work with println?

I tried doing this with println instead of printf. I just want to know if it didn't work because THEY were looking for printf exactly or it didn't work because console object doesn't work with println?

2 Answers

Mihailo Jakovljevic
Mihailo Jakovljevic
9,259 Points

You have to use printf instead of println, because println doesn't exist(isn't a method) for console. You can see this here: https://docs.oracle.com/javase/7/docs/api/java/io/Console.html if you scroll to Method summary. I hope that this isn't too confusing.

Hi lady carolina, I tries it my self and it seem that for some reason they want u to use console.printf instead of console.println for some reason that i don’t see. printf doesn’t print it in a new line , println does. this is the working code: int numberOfPeople = 3; if(numberOfPeople <= 4) { console.printf("Your table is ready"); System.exit(0);

}