This is my second attempt at running a program through the terminal. I finally found out how to change it to plain text so that i can add the .java extension and find it. It compiles and runs but doesn't quite do what i want. It detects if the number is too high or too low just fine. But when the correct number is guessed the command line just prints a "new" empty line when it should be saying "ding ding ding".

I have tried getting rid of the random number and assigning a set field, 77 for example. It still does not ding for me once the two are equal. I have also tried rearranging my if/else statements to try to get it to work. This simple game is making me != happy. Please point me in the right direction!!!

import java.util.Random;
import java.util.Scanner;
class UserGuess {
	public static void main(String[] args) {
 
	Random num = new Random();
	Scanner input = new Scanner(System.in);
 
	int winningNum = num.nextInt(100);
	int userGuess;
 
	System.out.println("Enter a number between 1 and 100");
	userGuess = input.nextInt();
 
	while (userGuess != winningNum){
	if (userGuess == winningNum){
	System.out.println("ding ding ding");
	} else if (userGuess > winningNum) {
	System.out.println("too high");
	userGuess = input.nextInt();
	} else {
	System.out.println("too low");
	userGuess = input.nextInt();
	}
 
 
	}
 
 
     }
}