generate 2 random numbers, then multiply

March 4, 2013 at 13:12:10
Specs: Windows 7
I have to generate 2 random numbers between 0 & 9, and then have the user guess the product, so far I can only get it to generate 1 number for me..how to do 2?
import java.util.Random;
public class multiply{
public static void main (String [ args){
Random randomNumbers=new Random();
int randomNumber=randomNumbers.nextInt(10);{
System.out.println(randomNumber);
}
}
}
}

The above gives my one random number.


See More: generate 2 random numbers, then multiply

Report •

#1
March 4, 2013 at 13:30:47
So call Random.nextInt() again.

How To Ask Questions The Smart Way


Report •

#2
March 4, 2013 at 13:46:23
I realize that somehow I need to have it generate a 2nd time.
This is a beginning Java class and I have no idea how to make it do that...sorry
And I also need to assign these 2 numbers "x" & "y".

Report •
Related Solutions


Ask Question