Java Java Basics Getting Started with Java IO

Robert Roberson
PLUS
Robert Roberson
Courses Plus Student 1,125 Points

I believe that I am passing the string firstName here but the complier say, it is not happening. // I have imported 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:"); console.printf("First name: %s", firstName);

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:");
console.printf("First name: %s", firstName);

1 Answer

Your second printf statement is what is asked for and all you need. Delete the first one.

Robert Roberson
Robert Roberson
Courses Plus Student 1,125 Points

Kris Nikolaisen, Thank so very much, problem solved.