Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![William Biggerstaff](https://secure.gravatar.com/avatar/bf333bc5ab36965ed5e873cd65908b1f?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
William Biggerstaff
466 PointsName console.readLine
String name = console.readLine(); isn5 correct, what's being ask3d of me?
String name = console.readLine();
1 Answer
![Simon Coates](https://secure.gravatar.com/avatar/6bed20ff9f56a4a1ce9a8d70a9e99565?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Simon Coates
8,223 PointsI think it's a flaw with the test code. The explanation for what's going wrong is complicated. But avoiding offering an explanation altogether seemed unsatisfactory. It's not your fault. It's not something that you could have deciphered. YOUR LINE OF CODE WAS FINE. For instance, I was able to run it successfully in the following program on an online sandbox.
import java.util.*;
import java.io.Console;
public class SayHi
{
public static void main(String[] args)
{
Console console = System.console();
String name = console.readLine();
System.out.println("Hi "+name);
}
}
The real console has a method called readLine() that accepts no parameters (see https://docs.oracle.com/javase/8/docs/api/java/io/Console.html#readLine-- ). However, their version of it (called console, but seemingly an instance of a class called MockConsole) seems to require a parameter (i.e. it doesn't have the full set of method overloads).
The problem will disappear if you provide a parameter.
String name = console.readLine("Can I get a value?");