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

Error: not a statement.

I am really irritated, because I am following the video exactly and I have no Idea what is going wrong with my code. I'm getting an error that ">=" is not a statement. The other problem is, it's in my "Game.java" file, which he does not open at all in the video! I need some help. https://teamtreehouse.com/workspaces/15164682#

Uriah, we need a bit more in order to be of any help. Can you include your code? Can you provide a link to the challenge you are having trouble with?

fyi: the to the workspace that you posted does not connect to anything...

That first link worked for me. It took me right to my workspace. Maybe it is restricted to anyone but the creator? How do I show you another way?

//Prompter.java file

import java.io.Console;

public class Prompter{
  private Game mGame;

public Prompter(Game game){
mGame = game;
}
public boolean promptForGuess(){
Console console = System.console();
  String guessAsString = console.readLine("Enter a letter:  ");
  char guess = guessAsString.charAt(0);
  return mGame.applyGuess(guess);
}
}
//Game.java file (where it found the error)

import java.io.Console;

public class Prompter{
  private Game mGame;

public Prompter(Game game){
mGame = game;
}
public boolean promptForGuess(){
Console console = System.console();
  String guessAsString = console.readLine("Enter a letter:  ");
  char guess = guessAsString.charAt(0);
  return mGame.applyGuess(guess);
}
}
//Hangman.java file
public class Hangman {

    public static void main(String[] args) {
        // Enter amazing code here:
      Game game = new Game("treehouse");
      Prompter prompter = new Prompter(game);
      boolean isHit = prompter.promptForGuess();
      if (isHit){
      System.out.println("It's a hit!");
      }
      else{
      System.out.println("Whoops! We got a miss.");
      }
    }

}

1 Answer

I get a page that says "Bummer. It appears the page you're looking for doesn't exist."

I would just copy and paste the code. We can sift through it. It's what we do here.