lundi 26 octobre 2020

How to place a random integer into a variable among some given numbers? [duplicate]

I have to write only one statement that puts a random integer into a variable from the numbers 50,78, 91, 565,250. This is where the statement will go:

public static void main(String[] args) {
 Random random = new Random();
 int randomInt;
 //single statement goes here
 System.out.println("The number is: “ + randomInt);

}




Aucun commentaire:

Enregistrer un commentaire