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

Moussa Ismail
Moussa Ismail
4,175 Points

I'm following the instructions but it still giving me errors

I'm using windows, could that have something to do with this?

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

2 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Moussa;

Welcome to Treehouse!

In your last printf statement, with the string formatter, you don't have a variable for it to utilize. Your variable firstName needs to be included in that line of code. If you didn't catch how to do that, I would recommend watching the video again.

Happy coding,

Ken

Hi Moussa,

It appears you're on task 3/3

Now replace your name with the firstName variable using the string formatter.

Your code is close, but when using the string formatter %s you also need to tell the printf function what string variable to use in its place.