Question: Recall that the code to create an array of Strings is: String[] array = new String[3]; An ArrayList is similar to an arrays, except it
Recall that the code to create an array of Strings is:
String[] array = new String[3]; An ArrayList is similar to an arrays, except it is:
- Resizable, meaning that it will automatically grow when needed. Unlike an array that only has unchangeable length, an ArrayList has: - size: the number of items currently in the ArrayList - capacity: the number of positions currently in the ArrayList - A Java class with methods. We cannot use [ ] notation with an ArrayList. Here is the code that creates an ArrayList of Strings:
ArrayList
null / null / null
1. Examine the above code that creates the array: How is the length of the array specified? 2. Examine the above code that creates the array: How many Strings are actually stored in the array after the array has been created? 3. Examine the above code that creates the ArrayList. How is the base type of the ArrayList specified? 4. Examine the above code that creates the ArrayList. How is the capacity of the ArrayList specified?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
