Need your opinions on my "Random phone number generator"
Hi, this is actually the second time in my life I have had to think like a programmer. It was great fun. I was wondering if anyone can judge my work and tell me what you think please? The program runs fine, but I don't know if this was an efficient or elegant solution. Thank you! Derek:D
Here is the code, it is pretty self explanatory.
public class RandomPhoneNum
public static void main(String args)
System.out.println("This app prints out a random phone number.");
System.out.println("The first set of 3 digits can't have 8 or 9 in them.");
System.out.println("The second set of 3 digits can't be greater than 742.");
Random generator = new Random();
int num1 = 0;
int num2 = 0;
int num3 = 0;
num1 = generator.nextInt(600) + 100;//numbers can't include an 8 or 9, can't go below 100.
num2 = generator.nextInt(641) + 100;//number has to be less than 742//can't go below 100.
num3 = generator.nextInt(8999) + 1000; // make numbers 0 through 9 for each digit.//can't go below 1000.
System.out.println("Here is a random generated phone number: " + num1 + "-" + num2 + "-" + num3);