I have a string array:
String[] fruits = {"Apple","Mango","Peach","Banana","Orange","Grapes","Watermelon","Tomato"};
and i am getting random element from this by:
String random = (fruits[new Random().nextInt(fruits.length)]);
now i want to get the number at which apple is present when i hit the button to get random fruit, like when i press randon button it gives me Banana..and also should give me that element number is 3
I get the element but have problem getting the element number, so please help me out