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

michael wright
michael wright
235 Points

i am not quite sure this is asking Now replace <YOUR NAME> in the console.printf expression with the firstName variable

I am doing task 3 on the strings and variables part, i am not sure what this asking me to do Now replace <YOUR NAME> in the console.printf expression with the firstName variable using the string formatter., can some one please help.

Name.java
String firstName = "Micheal"; console.printf ("String firstName = "Micheal");

2 Answers

Antonio De Rose
Antonio De Rose
20,884 Points
// I have setup a java.io.Console object for you named console
/*challenge 1*/String firstName = "Micheal";
/*challenge 2*/console.printf(firstName + " can code in Java!");
/*challenge 3*/console.printf("%s can code in Java!", firstName);

// %s, is what you want the string formatter to output, and you place that value, after a comma.
michael wright
michael wright
235 Points

Thank you very much, I am new to this, and I was lost on the step.

I am doing exactly like above, however my answer is not accepted by the system. it says " Bummer! Please make sure you leave your printf statement intact"

Antonio De Rose
Antonio De Rose
20,884 Points

send your code please, I'd be able to help you.