Java Java Basics Using your New Tools Multiple Format Strings

Kendhall Lebron Ruiz
Kendhall Lebron Ruiz
Pro Student 1,143 Points

readLine method.

It says to create a new variable that accepts input from the console using the readLine method, but I don't know what I'm doing wrong
// I've imported for you.  It is stored in a variable called console for you.
String name = console.readLine(); 

1 Answer

53,389 Points

If you check the preview you see: error: method readLine in class MockConsole cannot be applied to given types;
String name = console.readLine();
  required: String,Object[]
  found: no arguments
  reason: actual and formal argument lists differ in length
1 error

So the checker is expecting an argument for readLine.

String name = console.readLine("Enter something");