Java Java Basics Getting Started with Java IO

Luis Paulino
Luis Paulino
Pro 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.
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,148 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);