Q:

Advanced - If / else if / else -statement

I am trying to make a minigame where the user has to guess if the his number is higher or lower than the computer's.
I'm having some trouble making the scanner (if it is necessary) and the if / else if / else -statement.
My code looks like this:
import java.util.Random;
import javax.swing.JOptionPane;

    public class Main {

        public static void main(String args)
        {
                //This will create the numbers.
            Random userNumber = new Random(10);
            Random comNumber = new Random(10);
            System.out.println("The USER was given the number: " + userNumber);
            System.out.println("The COMPUTER was given the number: " + comNumber);

                //This will ask if the USERS think that their number is HEIGHER, LOWER or EQUAL TO the COMPUTER's number.
            String heigerOrLower = JOptionPane.showInputDialog("Do you thinks that your number is heigher(H), lower(L) or equal-to(e) the computer's? ");

                //This if / else -statement will check if the users choice is right or wrong.
            if(){

            }
        }

    }

I don't know how to make the statement check for this:
1) If the user's number is lower than the computer's - and if the user typed in " L " at the same time.
2) If the user's number is equal to the computer's - and if the user typed in " E " at the same time.
3) If the user's number is higher than the computer's - and if the user typed in " H " at the same time.

A:

Random objects provide a source from which random numbers can be produced -- they are not the random numbers themselves. You only need one Random instance:
Random rand = new Random()

int userNumber = rand.nextInt(10);
int comNumber = rand.nextInt(10);

Now you can compare userNumber and comNumber numerically. For instance, to accomplish your first point:
if (userNumber < comNumber && higherOrLower.equalsIgnoreCase("L")) {
    ...
}

