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

Program won't run

String firstName = "Mike" ; console printf("Hello my name is %s \n", firstName); console.printf( "%s is learning to write java \n"), firstName:

Name.java
// I have setup a java.io.Console object for you named console
String firstName = "Mike";
console.printf("Hello my name is %s \n",firtName);

1 Answer

Rob Bridges
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Rob Bridges
Full Stack JavaScript Techdegree Graduate 35,467 Points

Hello, it looks like this was just a simple mistype of the variable firstName in your print statement, other than that your code is fine. it looks like you're trying to pass the variable with the mistype of "firtName"

I do notice that in the later challenges they are going to be very picky about what you right, as in the next one they ask for "<your name> can code in java" and unless that's what passes even if the code is completely correct i.e. you accidentally forget to change it and pass "Hello my name is %s \n",firstName it will say that it is wrong because it did not see the exact string it was looking for.

Something to look out for.

Great job getting it right besides that though!