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

console.printf("hi my name is %s", firstName); is there a spelling mistake in this.

The compiler shows ther is a spell mistake in

  console.printf("hi my name is  %s", firstName);

but I don't think there is a spell mistake

// I have setup a java.io.Console object for you named console
//console console = System.console();
String firstName = "Ankit";
console.printf("hi my name is  %s", firstName);

1 Answer

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there! Yes and no. Your variable name is spelled correctly, but you're not printing out what the instructions are asking for. Take a look:

"<YOUR NAME> can code in Java!"

But you're printing out "hi my name is". This will cause the challenge to fail. Challenges can be (and often are) very strict with what they get back from your code. In most cases it must match to the letter. This includes punctuation, capitalization, and even spacing.

Hope this helps! :sparkles: