Random.nextInt() has the following syntax.
public int nextInt()
In the following code shows how to use Random.nextInt() method.
//from w w w . j av a2s .c o m import java.util.Random; public class Main { public static void main( String args[] ){ Random randomno = new Random(); // check next int value System.out.println("Next int value: " + randomno.nextInt()); } }
The code above generates the following result.