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


error: incompatible types: String cannot be converted to char. Not sure what to do. I followed the video.

import java.util.Scanner;

class Prompter { private Game game;

public Prompter (Game game) { this.game = game; }

public boolean promptForGuess() { Scanner scanner = new Scanner(System.in); boolean isHit = false; boolean isAcceptable = false;

do {
    System.out.print("Enter a letter:  "); 
    String guessInput = scanner.nextLine(); 
    try { 
      isHit = game.applyGuess(guessInput);              <<--***--- (problem)
      isAcceptable = true;
    catch (IllegalArgumentException iae){
      System.out.printf("%s. Please try again. %n",
} while (! isAcceptable); 
return isHit; 

public void displayProgress() { System.out.printf("You have %d tries left to solve: %s%n", game.getRemainingTries(), game.getCurrentProgress()); } }

1 Answer

Not sure what video you are on but this one @ 6:13 shows the code also includes:

char guess = guessInput.charAt(0);

and guess is passed to game.applyGuess();