Java Java Basics Getting Started with Java IO

Alex Lee
Alex Lee
408 Points

help me what did I do wrong...

Please help me I'm stuck ...

IO.java
// I have imported java.io.Console for you.  It is a variable called console.
String firstName = console.readLine("Alex");
String lastName = console.readLine("Lee");
console.printf("First name:", %firstName);

2 Answers

calp
calp
8,728 Points

As Ben said, you need to put %s on the left side inside of the quotes (next to first name) and then pass the variable into printf as a parameter (without the % in front of it).

Ben Reynolds
Ben Reynolds
35,148 Points

The "%" symbol should be "%s" and goes inside the string (before the closing quote mark). The firstName variable will be inserted into the string at the position of %s.