Java Java Basics Getting Started with Java IO

.....bh

.....

IO.java
// I have imported java.io.Console for you.  It is a variable called console.

String firstName = console.readLine("What is your name?");

String lastName = console.readLine("What is your last name?");

console.printf("First name:" + %s  );

2 Answers

Steven Parker
Steven Parker
203,748 Points

The replacement token needs to be inside the template string, and the value to fill it with must be supplied as an additional argument:

console.printf("First name: %s", firstName);

Thank you very much Steven