Welcome to the Treehouse Community
Looking to learn something new?
Chase Setser3,802 Points
Combining string variables inside printf?
Hello, is it possible to do something like this?
// I have imported java.io.Console for you. It is a variable called console.' String firstName = console.readLine("What's your first name? "); String lastName = console.readLine("What's your last name? "); console.printf("First name: %s. Last name: %s", firstName, lastName);
Simon Coates28,692 Points
The printf is fine. If you want to see output at the challenge, use something like the following, since you don't have access to the console in the challenge.
String firstName = "d"; String lastName = "e"; System.out.printf("First name: %s. Last name: %s", firstName, lastName);
clicking on preview gets you: First name: d. Last name: e