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 trialLuis Delacerda
196 Pointswhat do i do
sdfsdfsdfsf
// I have setup a java.io.Console object for you named console
String firstName = ("Luis");
console.printf("Hello, my name is Luis");
console.printf("Luis can code in Java!");
1 Answer
doesitmatter
12,885 PointsThey want you to make use of the variable you created, instead of literally writing your name again. And with the printf method theres a nice way of doing this:
console.printf("Hello, my name is %s", firstName);
In the code above %s will be replaced with the value stored in firstName. The s stands for String.
Without using the printf method. printing the same thing out would be:
console.print("Hello, my name is " + firstName);
This achieves the same result, but its better to get used to printf as this will be much more useful in the future when you need to print formatted strings.