1. Array basics

array introduction
Figure 1. The array myList has ten elements of double type and int indices from 0 to 9.
  • Declaration, creation and initialization of array

  • Reference type

  • Zero-based index

  • Array length

  • Array Initializer

  • Accessing and setting array element

  • ArrayIndexOutOfBoundsException

  • Months.java

2. Example

deck of cards1
Figure 2. 52 cards are stored in an array named deck.
deck of cards2
Figure 3. CardNumber identifies a card’s suit and rank number.

3. Copying arrays and pass-by-reference [1]

reference assignment
Figure 4. Before the assignment statement, list1 and list2 point to separate memory locations. After the assignment, the reference of the list1 array is passed to list2.

4. Variable length argument list

5. The Arrays class and Command Line Parameters

6. Multidimensional arrays

1. In the book pass-by-reference is referred to as pass-by-sharing