Generics and the ArrayList Class in java
Generics and the ArrayList Class in java 1. Suppose list is an object of the class ArrayList<String> . How do you add the string "Hello" to the ArrayList list ? 2. Suppose instruction is an object of the class ArrayList<String> that contains the string "Stop" at index position 5 . How do you change the string at index position 5 to "Go" (without changing any of the elements at other positions)? 3. Suppose instruction is an object of the class ArrayList<String> that contains strings at index positions 0 through 10 . How do you insert the string "Go" at index position 5 so that no strings are removed from the list instruction?
Written for
- Institution
-
Harvard University
- Course
-
Java programming
Document information
- Uploaded on
- February 7, 2023
- Number of pages
- 9
- Written in
- 2022/2023
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
generics and the arraylist class in java
-
generics and the arraylist class
Also available in package deal