Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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: