int a = new java.util.Random().nextInt(①);
If an integer of 1 or more is specified in ①, a random integer of 0 or more and less than the number specified in ① is assigned to a.
Example: Substituting 10 causes any of 0 to 9 to be substituted for a
** Accepts character string
input **
String a = new java.util.Scanner(System.in).nextLine();
** Accepts integer
input **
int a = new java.util.Scanner(System.in).nextInt();
Recommended Posts