Hi everyone,
I m running program but got stuck in after if/else if statements, Jpane doesnt show anything.I couldnt figure out.
Thanks
public class FancyGuessingGame
{
public static void main(String[] args)
{
Scanner console = new Scanner(System.in);
int guess;
int num;
String name;
String Guess;
name = JOptionPane.showInputDialog(null, "Please enter your first name");
Guess = JOptionPane.showInputDialog(null, "Please enter a guessing number");
guess = Integer.parseInt(Guess);
guess = console.nextInt();
num = (int) Math.random()*10+1;
if (guess == num)
{
JOptionPane.showMessageDialog (null, "You guessed the correct number");
}
else if (guess != num && guess < num )
{
JOptionPane.showMessageDialog(null, "Your guess is lower than the number. Guess again!");
}
else//(guess != num && guess > num)
{
JOptionPane.showMessageDialog(null, "Your guess is higher than the number. Guess again!");
}
System.exit(0);
}
}