Arrays: Called Initial Values, That Are Placed
Arrays: Called Initial Values, That Are Placed
• Array List
Chapter 9
• Array List (continued)
• Arrays
• Array List (continued)
• Chapter Objectives
• Array List (continued)
• Learn about arrays
Specifying Array Size During Program Execution
• Explore how to declare and manipulate
data into arrays • The initializer list contains values,
called initial values, that are placed
• Understand the meaning of “array
between braces and separated by
index out of bounds”
commas
• Become familiar with the restrictions on
• Here, sales[0]= 12.25, sales[1]= 32.50,
array processing
sales[2]= 16.90, sales[3]= 23.00, and
• Chapter Objectives (continued) sales[4]= 45.68
• Every element is of the same type • Associated with each array that has
been instantiated, there is a public
• Elements are accessed using their (final) instance variable length
relative positions in the array
• The variable length contains the size of
• One-Dimensional Arrays the array
• One-Dimensional Arrays (continued) • The variable length can be directly
• One-Dimensional Arrays (continued) accessed in a program using the array
name and the dot operator
• intExp = number of components in
array >= 0 int[] list = {10, 20, 30, 40, 50, 60};
• You can store the number of filled • Determining Largest Element in Array
elements, that is, the actual number of • Determining Largest Element in Array
elements, in the array in a variable, say (continued)
numOfElement
• Determining Largest Element in Array
• It is a common practice for a program (continued)
to keep track of the number of filled
elements in an array • Array Index Out of Bounds
• Declaring arrays
• Instantiating arrays
• Processing arrays
– Entire array
– Row processing
– Column processing