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

Adam Wolfson
Adam Wolfson
159 Points

The preview has the proper output, but it still says my work is wrong.

I attempted to do what the question is asking me by printing my name. It properly printed my name in the preview, but I was told it was incorrect by check work. I thought that maybe I was not taking the question literally enough, so I changed the output to YOUR NAME, but that still was not right. Am I misunderstanding the question?

Name.java
// I have setup a java.io.Console object for you named console
String firstName = "YOUR NAME";
console.printf("%s", firstName);

1 Answer

Alexandra Barnett
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexandra Barnett
Front End Web Development Techdegree Graduate 46,473 Points

Hi Adam!

You have got the string formatting exactly correct but, in the question, they want you to output your "<first name> can code in Java!". Once you have done that, it should work :):

String firstName = "Alex";
console.printf("%s can code in Java!", firstName);