Java Unit 4 - Arrays & ArrayLists Flashcards
Term: Array
Definition: A data structure in which items are arranged as a numbered sequence, and each item can be referred to by its position number. In Java, all items in an array must be of the same type, and numbering starts at zero.
Term: Base Type
Definition: The type of the individual items in an array is called the base type of the array. It determines the data type of the elements within the array.
Term: Index
Definition: The position number of an item in an array is called the index of that item. Indexing starts at zero in Java.
Term: Random Access
Definition: The ability to access any element in an array directly, without the need to traverse the elements sequentially.
Term: Sequential Access
Definition: Accessing elements in an array one after the other in the order they occur in the array.
Term: Partially Full Arrays
Definition: Arrays where the number of items stored in the array can change during program execution. A separate counter variable is often used to keep track of the number of valid items in the array.
Term: Two-dimensional Arrays
Definition: Arrays in which elements are arranged in rows and columns, creating a grid structure. They are useful for representing data in a tabular form.
Term: Nested Loops
Definition: Using multiple loops, one inside the other, to efficiently process two-dimensional arrays, allowing access to individual elements by specifying both row and column indices.
Term: Element
Definition: Individual values stored within an array. Elements are accessed using their index.
Term: Array of Arrays
Definition: A two-dimensional array can be thought of as an array of arrays. Each βsub-arrayβ represents a row, and elements within a row are accessed using both row and column indices.
Term: Data Structure
Definition: A collection that consists of a number of data items chunked together so that they can be treated as a unit.
What is the syntax for declaring and initializing an array?
array-variable = new base-type[array-length];