Examine the following code snippet. Add the necessary code…
Examine the following code snippet. Add the necessary code to do the following tasks, in order: Shuffle the list. Add a new fruit to the list. You may choose the fruit. Sort the list. Locate the index of “Orange” in the list. Print the list as an array. Indicate what the output of the program would be once it’s run. import java.util.ArrayList;import java.util.Collections;import java.util.List;public class Main{ public static void main(String[] args) { List fruits = new ArrayList(); fruits.add(“Banana”); fruits.add(“Mango”); fruits.add(“Orange”); fruits.add(“Apple”); /* your code here */ }
Read Details