Basic ArrayLists 0

Create an ArrayList that can hold Integers. Add ten copies of the number -2327 to the ArrayList. Then display the contents of the ArrayList on the screen.

Do not use any loops. Also, do not use any variable for the index; you must use literal numbers to refer to each slot.

Slot 0 contains a -2327
Slot 1 contains a -2327
Slot 2 contains a -2327
Slot 3 contains a -2327
Slot 4 contains a -2327
Slot 5 contains a -2327
Slot 6 contains a -2327
Slot 7 contains a -2327
Slot 8 contains a -2327
Slot 9 contains a -2327

For this assignment, you are not allowed to just display the ArrayList all at once; you must display it one slot at a time as shown -- without using a loop.




©2003–2016 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License