Chapter 8 Flashcards
What is an Array?
- Named list of data items with the same data type
- Each data item is an element of the array
How do you name an array?
- Provide any legal identifier
- Same naming conventions as variables
What does int[] someNums; or int[] someNums = null;
- No computer memory adress is assigned
- The array has the special value null
What do array names represent?
- Computer memory adress
What is a instance variable for arrays?
- A fielt automatically assigned a value for every array you create
- Length field
What is a flag?
- A variable that holds a value as an indicator of whether or not a condition has been met
What happens if you pass a whole array into a method?
The array can change
What does the length field return in a two-dimensional array?
How many rows
What are jagged arrays?
- Rows of different lengths
- Also called ragged array or non-rectangular array
- Define number of rows, but not columns
How do you use the arrays class?
Import java.util.Arrays
What are the Array class methods?
BinarySearch()
equals()
fill()
sort() * Ascending
ParrelelSort *Ascending
What are Enumerations?
- Finite set of legal values
- Constants are all uppercase
- no equals
- no Quotes
What are the enum methods?
toString()
Ordinal() * position
equals() * tests if two enums are equal
compare() * returns a value based on ordinal value
valueOf() accepts a string aprameter and returns an enum
value() returns an array of the enums