ISM 6148 Java Chapter 7 Single Dimensional Arrays

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Selection sort

finds the smallest number in the list and swaps it with the first element. It then finds the smallest number remaining and swaps it with the first element in the remaining list, and so on, until only a single number remains.

array type

A variable is declared as an __________ using the syntax elementType[] arrayRefVar or elementType arrayRefVar[]. The style elementType[] arrayRefVar is preferred

arrayRefVar.length

After an array is created, its size becomes permanent and can be obtained using ....

integer, integer

An index must be an ________ or an _______expression.

arrayRefVar[index]

Each element in the array is represented using the syntax

array initializer, elementType[] arrayRefVar = {value0, value1, . . . , valuek}

Java has a shorthand notation, known as the _____________, which combines declaring an array, creating an array, and initializing an array in one statement, using the syntax _____________.

off-by-one error

Programmers often mistakenly reference the first element in an array with index 1, but it should be 0

arrayRefVar.length − 1

Since the index of an array always begins with 0, the last index is always _______________. An out-of-bounds error will occur if you attempt to reference elements beyond the bounds of an array.

not , not, reference

Unlike declarations for primitive data type variables, the declaration of an array variable does _____allocate any space in memory for the array. An array variable is ______a primitive data type variable. An array variable contains a _______ to an array.

\u0000 , false

When an array is created, its elements are assigned the default value of 0 for the numeric primitive data types, _______for char types, and ______ for boolean types.

cannot

You ________ assign elements to an array unless it has already been created.

new elementType[arraySize]

You can create an array by using the new operator with the following syntax:


Ensembles d'études connexes

PrepU Ch 70: Oncologic and Degenerative Neurologic Disorders

View Set

Exam 2: Fluid/Electrolyte Review

View Set

Temporary Immigration Programs - Temporary Entry

View Set

Joints and Movements: Support and Movement

View Set

World History: England: Fires of Continuation (Unit 7)

View Set