Need help creating a continuousGame method that will work with my file

I'm trying to finish this program I've been working on for a while, but I'm very confused as to how to create the continueGame method when the return value should be Boolean, but using an entry as the value. I can not make any changes to the main file, so I can only modify the methods implemented in this file. The problem is that the if / else if statements will continue to loop without ever reaching the continueGame () method, I made some changes earlier, but I could not get the program closed if I entered "n " I've created a file called GameOptions and it's there that I have my code:

                public int getChoice (Scanner scnr) {

System.out.println ("Please choose a number between 1 and 10:");
int userGuess = 0;
String entry = ();
try {
userGuess = Integer.parseInt (input);
if (userGuess < 1 || userGuess > ten) {
throws new IllegalArgumentException ("Invalid value, enter a number between 1 and 10:");
catch (NumberFormatException e) {
System.out.println ("Error - Enter numeric values ​​only");
return userGuess;
catch (IllegalArgumentException ex) {
System.out.println (ex.getMessage ());
return Integer.parseInt (input);

public void checkAnswer (int userChoice, int answer, Scanner scnr) {
if (userChoice> answer && userChoice <11) {
System.out.println ("Too high, try again.");
count ++;
} else if (userChoice < answer && userChoice > 0) {
System.out.println ("Too low, try again.");
count ++;
} else if (userChoice == answer) {
System.out.println ("You have it! Number of tests:" + number);

public static boolean continueGame (Scanner scnr) {
System.out.println ("Do you want to replay? (Y / n)");
String entry = scnr.nextLine ();
if (input.toLowerCase (). equals ("y")) {
return true;
} else if (input.toLowerCase (). equals ("n")) {
returns false;
} other {
System.out.println ("Invalid entry, please enter y or n:");
returns continuesGame (scnr);

Here is the main driver for this GameOptions class:

                Public class NumberGame
public static void main (String[] args)
Scanner input = new Scanner (;
GameOptions opt = new GameOptions (); // Your created class
int userChoice = -1234;
int response = -1234;
keepPlaying boolean = true;

System.out.println ("Guess the number set  n");

while (keepPlaying == true) {
answer = (int) (Math.random () * 10) +1;

// Create a getChoice method in your class and make sure that it accepts a Scanner argument.
userChoice = opt.getChoice (input);

// Create a checkAnswer method in your class. Make sure that it accepts two integer arguments and a Scanner argument.
opt.checkAnswer (userChoice, answer, input);

// Create a continuousGame method in your class and make sure that it accepts a Scanner argument.
keepPlaying = opt.continueGame (input);
System.out.println ("Thank you for playing.");