how to get a random from string[] java code example
Example 1: get random element from string array java
String random = (fruits[new Random().nextInt(fruits.length)]);
Example 2: get random element from string array java
String[] fruits = {"Apple","Mango","Peach","Banana","Orange","Grapes","Watermelon","Tomato"};