You’ve already generated a random number here:
new Random().nextInt(names.length)
You can use this random number to access an element in the names
array.
int randomNumber = new Random().nextInt(names.length);
String option = names[randomNumber]; // here is the important bit!
Now you can print option
out!
System.out.println("You are going to eat " + option);
0
solved How do I display the actual input instead of option number? [closed]