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 IO

Luis Paulino
PLUS
Luis Paulino
Courses Plus Student 1,779 Points

I'm not sure what to do here?

But, I feel like i'm getting better. Please send pics visual learner.

IO.java
String firstName= console.readLine("first name");
String lastName= console.readLine("last name" );
console.printf("First name:Luis %s",);

1 Answer

Ben Reynolds
Ben Reynolds
35,170 Points

The "%s" in a formatted string is a placeholder for whatever goes in the second argument of the printf method (although you can have as many as you want separated by commas). The syntax is like this:

String someString = "test";

console.printf("This is a %s.", someString);

// Will print "This is a test."


// Or with multiple arguments:

String string1 = "another"
String string2 = "test";

console.printf("This is %s %s.", string1, string2);