One-shot number guessing game
int diff = guessNum - randomNum;
    if (guessNum &gt;= randomNum) {
      System.out.println(diff);
    } else { System.out.println(randomNum - guessNum); }



You mix styles here.  Consider 

    if (guessNum &gt;= randomNum) { System.out.println(guessNum - randomNum); }
    else { System.out.println(randomNum - guessNum); }


That's a distinct style.  It puts the {} on the same line as the contained statement and it does every calculation just when it is needed.  Most importantly it's consistent.  

I don't like that style.  It's especially uncommon.  I'd prefer 

    int difference = guess - solution;
    if (difference &gt;= 0) {
        System.out.println(difference + " high.");
    } else {
        System.out.println(-difference + " low.");
    }


We only calculate the difference once.  Then we use it three times.  

This uses a four-column indent, which is standard in Java.  

This puts {} on the same lines as their control structures when possible.  And it puts the enclosed statements on lines of their own.  Also standard in Java.  

I changed the names of the variables to concentrate on their role in the program.  Not characteristics of how they are defined, e.g. randomly or numeric.  This leaves us with more flexibility to change in the future.  For example, this version could be easily modified to guess letters.  

If you don't like the high/low, you could just say 

    System.out.println(Math.abs(guessNum - randomNum));


No intermediate variables or if/else that way.