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 trialeren
503 PointsNow replace <YOUR NAME> in the console.printf expression with the firstName variable using the string formatter.
Stuck on Java Basics: Task 3 of 3 :(
2 Answers
A Y
1,761 PointsErene,
You probably know how print your name to the screen you use printf method such as: console.printf ("Hello, my name is Erene"); Anything between " " is text or String and will be print on the screen the way you have typed it.
In your question: Now replace <YOUR NAME> in the console.printf expression with the firstName variable using the string formatter. <YOUR NAME> is your actual name "Erene". firstName variable means using a variable to keep the value of your name "Erene" on it: String firstName = "Erene"; The string formatter is the %s which formats value as a string. It will format the firstName variable to String "Erene": console.printf ("Hello, my name is %s", firstName);
All what you have to do here is to simple steps: String firstName = "Erene"; console.printf ("Hello, my name is %s", firstName);
I believe this tutorial website will help you to understand more about Java basics: https://www.javatpoint.com/java-tutorial
Hope that I was able to give you any help, Amir
eren
503 PointsThank you, guys!
Mark Gormley
543 PointsMark Gormley
543 PointsSo you have to replace your name with the variable you made in the first line. Remember the %s?