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);

}