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 Strings, Variables, and Formatting

KEVIN SINGH
KEVIN SINGH
682 Points

there is some problem with this console , Help

My console is saying "Leave the printf statement intact" Mine is String firstName = "Kevin"; console.printf ("%s can code in Java", firstName);

Name.java
// I have setup a java.io.Console object for you named console
String firstName = "Kevin";
console.printf ("%s can code in Java", firstName);

1 Answer

andren
andren
28,558 Points

The code checker doesn't like the fact that there is a space between your method and it's parenthesis. While it's technically valid to have that space in Java it is rare for most programmers to put a space between them like you have done. The challenge checker for this task was not designed to handle that specific scenario. If you remove the space like this:

// I have setup a java.io.Console object for you named console
String firstName = "Kevin";
console.printf("%s can code in Java", firstName);

Then your code will pass the challenge.