import java.util.ArrayList; // Import the ArrayList class public class ArrayListPractice { public static void main(String[] args) { // 1. Create an ArrayList object that holds Strings, initialize the capacity to size 10 ArrayList<> solarSystem = new ArrayList<>(); // 2. Add a String for each of the first five planets to the solarSystem ArrayList solarSystem.add(planet_name_here); // 3. Below is an example of a for-each loop. It will print the entire contents of your ArrayList so far for (String s : solarSystem) System.out.print(s + ", "); System.out.println(); // 4. At index 3 insert the String containing the name of our planet's only natural satellite solarSystem.add(index_here, planet_name_here); // 5. Use a for-each loop to print the contents of your solarSystem ArrayList again below // 6. Now add our local star and the collective group of celestial objects between Mars and Jupiter at their respective indices // 7. The code line below tries to print the element at index 8. Wwhy doesn't it work -- you initialized the capacity to size 10, right? // Type your answer here then comment out the line below: System.out.println(solarSystem.get(8)); // 8. Add the remaining planets that come after Jupiter to your ArrayList, go ahead and add Pluto as well // 9. What is the size of your ArrayList now? Print a line that uses the .size() method on your ArrayList // 10. How is the size bigger then the initial capacity you provided? What happened? // Answer: // 11. Another ArrayList, solarSystem2 that is a "copy" of your first solarSystem ArrayList ArrayList solarSystem2 = solarSystem; // 12. Print solarSystem2 with a for each loop. Is it the same as solarSystem? // Answer: // 13. Remove Pluto from the solarSystem ArrayList. It's not really a planet anyway... D: // 14. Print solarSystem2. Has it changed, and if so, why? // Answer: // 15. Remove the first seven elements in the solarSystem ArrayList with a for loop, careful you are removing the right indices! // 16. Make another ArrayList of Strings called solarSystem3 and initialize it with these values: Jupiter, Saturn, Uranus, Neptune // 17. The ArrayLists solarSystem and solarSystem3 should be the same. Check with == and .equals(). } }