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

Using the printf method to display my name.

I have tried this exercise many times and I cant figure out what I am doing wrong. I typed in console.printf("My name is %s", firstName); The string is set but this line doesn't work.

Name.java
// I have setup a java.io.Console object for you named console
String firstName = "Lamoine";
console.printf("My name is %s", firstName);
Jorge Flores
Jorge Flores
7,864 Points

Hi Lamoine, im wodnering if you imported the io console object, if you didnt add the next code line

import java.io.Console;

1 Answer

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Lamoine;

The challenge is looking for output along the lines of Lamoine can code in Java! Make sure your output value matches what is called for. Your syntax looks good, just the minor change in the output text and you should be good to go.

Welcome to Treehouse and happy coding,

Ken

Yea that did it lol, thanks I didn't realize I had to put in specific words I thought the challenge was only checking the syntax. Thanks for the help.