how do i get random number for 10 to 99
is this right
Random generator = new Random();
int num1;
num1 = generator.nextInt(99)+ 10;
System.out.println(+num1); or

or this is right does it go from 0 to 99???

num1 = generator.nextInt(99);
System.out.println(+num1);
which is the code for 10 to 99

num1 = generator.nextInt(90)+ 10; will add a random int between 0 and 89 to your base value of 10.
From the API doc:

Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive)

A little bit of experimentation would have quickly yielded the answer for you. If you had placed that code in a throwaway test class main() method, you could see the result pretty quickly. Don't be afraid to test little things like this in isolation to gain a better understanding of the API.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.