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!
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

Aaron Williams
1,702 PointsType mismatch: cannot convert from void to String
I am getting the error on String guessAsString
public boolean promptForGuess() {
String guessAsString = System.out.println("Enter a letter: ");
char guess = guessAsString.charAt(0);
return mGame.applyGuess(guess);
}
4 Answers
Henrik Hansen
23,176 PointsSystem.out.println("Enter a letter: ");
This is printing a line, not prompting for a string. That is why it won't return anything, instead of returning a String.

Eric De Wildt
Courses Plus Student 13,077 PointsYou need to get the console to read the input on the line from the user. Your current code just prints out a line on the console. So what do you think you need to put to get the console to read some input?

Eric De Wildt
Courses Plus Student 13,077 PointsThat's because the code you posted is wrong. You should get errors anywhere you run the code you posted because it's not right. Try this:
public boolean promptForGuess() {
String guessAsString = System.out.readLine("Enter a letter: ");
char guess = guessAsString.charAt(0);
return mGame.applyGuess(guess);
}

Aaron Williams
1,702 PointsOk sorry I said it wrong....... I am not getting errors with the challenge I am getting errors in the eclipse console.
Ken Alger
Treehouse TeacherKen Alger
Treehouse Teacheredited for markup
Please see this post for instructions on posting code to the forum.