ITM 200 Chapter 9: Chapter 9
Document Summary
9. 1 problem: an array of integers is effectively a sequence of integer variables, which you can refer to individually by giving their position in the sequence. Automatic initialization: when an array is created, if it contains, numbers they are initialized to zero, booleans they are initialized to false, references they are initialized to null. Array index: array index type must be integer, array index starts at 0, means that the index of the last element will be the number of elements in the array 1. Accessing an array element: refer to pg 201. Length: length contains the number of components in its associated array, that is the length of an array is the value of the expression. 9. 5 more on array reference variables: example on pg 203-204. Dry running programs containing arrays: dry running is a good way to understand and debug programs containing arrays. Initialize lists: when you create an array of integers, java automatically initialize them to 0.