Hey there! This problem might be a bit unpredictable, but give it a go and let us know how you do!
Create a program that manages a fruit inventory using a List. Add three fruits, remove one, and replace another with a new fruit. Fill in the blanks in the code to complete the inventory management system and display the final contents.The List interface
Juicy juggling in the digital orchard
Report a typo
Fill in the gaps with the relevant elements
<String> inventory = new <>();
inventory.("Apple");
inventory.add("Banana");
inventory.add("Orange");
String itemToRemove = "Banana";
inventory.(itemToRemove);
int indexToUpdate = 0;
inventory.(indexToUpdate, "Grapes");
System.out.println("Updated inventory: " + inventory);Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.