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

Java Java Basics Using your New Tools Multiple Format Strings

Bug in Multiple Format Strings challenge

This issue has been raised earlier here: https://teamtreehouse.com/community/level-bug-on-java-basics

When I use console.readLine() it doesn't work, but when I pass in a string console.readLine("Enter your name: "), it does.

readLine() method should work with or without an argument. Even if it is expected with an argument, it shouldn't throw an error.

JavaTester.java:116: 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

Mods, please look into this.

// I've imported java.io.Console for you.  It is stored in a variable called console for you.
String name = console.readLine();

Have you tried putting some text inside of your parenthesis. It kind of seems like that is what it is expecting. Just throw a set of quotation marks in there and see if that fixes it.

Thx Jeremy, but I already mentioned in my post above that it works fine with the argument. The issue is (at least I think it is) parameters in readLine() method are optional so it shouldn't throw syntax error when we don't pass the String argument.