
Here is the stickler. I could not recall how to generate random numbers. Sure I can look it up with Google. But a strong Java developer knows this stuff by heart. I seemed to recall Math.random once I saw it. But that is for doubles. I needed some ints. And the java.util.Random class was just what the doctor ordered.
You can instantiate the Random class without any parameters. Or you can pass a seed for the random number generated as a parameter to the constructor. Once you have a Random object, just call the nextInt method and you get a number between 0 and n-1 (n is the parameter you pass nextInt).
Now I had my number guessing program working in no time. I decided to add a little spice to the program that was not required. No I don't have Guess jeans models popping up on the screen. I just let the user keep guessing until they arrive at the solution. And I throw in some taunts as responses when you guess is wrong. Good stuff.