Code for Random Number Guesser Game

Make a program where computer generates a number and user has to guess the right number. Iterate till correct guess and also give hints.

import java.util.*;
import java.lang.Math;

public class GuesserGame {
    private int secret;
    private boolean game = false;

    public void guess(){
        secret = (int) (Math.random() * 500);
        int num = 0;
        int guesscount = 0;

        while (!game){
            System.out.println("Guess a number 1-500: ");

            // Scanner for int
            Scanner sc = new Scanner(System.in);
            num = sc.nextInt();
            System.out.print("" + num + " - ");
            // increment guesscount and check if guess is correct
            guesscount++;
            if (num == secret) {
                System.out.println("Congratulations! You got it right in " + guesscount + " guesses !");
                game = true;
            }
            else if (num > secret) {
                System.out.println("Your guess is too high!");
            }
            else if (num < secret) {
                System.out.println("Your guess is too low!");
            }
        }
    }

    public void guess(int num){
        
        
        
    }
}

GuesserGame a = new GuesserGame();
a.guess();
Guess a number 1-500: 
4 - Your guess is too low!
Guess a number 1-500: 
100 - Your guess is too low!
Guess a number 1-500: 
300 - Your guess is too high!
Guess a number 1-500: 
200 - Your guess is too low!
Guess a number 1-500: 
250 - Your guess is too high!
Guess a number 1-500: 
225 - Your guess is too low!
Guess a number 1-500: 
240 - Your guess is too high!
Guess a number 1-500: 
230 - Your guess is too high!
Guess a number 1-500: 
227 - Congratulations! You got it right in 9 guesses !