Transcript

1 Chapter 9 Arrays Java Programming from Thomson Course Tech, adopted by kcluk 2 Array Definition: structured data type with a fixed number of components Every component is of the same type Components are accessed using their relative positions in the array 3 One-Dimensional Arrays Syntax to instantiate an array: dataType[ ] arrayName; arrayName = new dataType[intExp] dataType[ ] arrayName = new dataType[intExp] dataType[ ] arrayName1, arrayName2; Syntax to access an array component: arrayName[indexExp] intExp = number of components in array >= 0 0


Top Related