error in code of Guessing game java
<p>okay, so this is suppose to be part of the full code, but the gist is, user guess the answer to a guessing number game and the moment user gets it right:</p>

<pre><code>if (guess==num){
    System.out.println("You Win!");
    System.out.println("Play Again?? Y/N");

    String play=scan.nextLine();

    if(play.equalsIgnoreCase("y")){
        Game();
    }

    if(play.equalsIgnoreCase("n")){
        System.exit(1);
    } else {
        invalid(); //when playing again, it says you entered an invalid choice which i do not want.

        play=scan.nextLine();

        if(play.equalsIgnoreCase("y")){
            Game();
        }
    }
}
</code></pre>

<p>the output was:</p>

<p>.............................................</p>

<p>14</p>

<p>You Win!</p>

<p>Play Again?? Y/N</p>

<p>You entered an invalid choice, please re-enter Y/N       &lt;&lt;===== the problem is here
.................................................................</p>

<p>What i want is an input from the user in response to the play again?? question, but i do not understand what part of the code that caused me to print out you entered an invalid choice, can someone help? i just cant see the problem sadly. i still need the invalid method because i want to tell the user that when they enter an invalid answer to the y/n question.</p>
