Chapter 7: Single Arrays Flashcards
What’s the preferred syntax when declaring a variable?
elementType[] arrayRefVar;
Double[] myList;
How to create an array?
arrayRefVar = new elementType[arraysize];
What is an indexed variable?
An individual element inside of an array.
How can you create a new arrary with a name and size?
elementType arrayRefVar[] = new elementType[arraySize];
EXAMPLE
double[] myList = new double[10];
What are the two types of array searches?
Linear and Binary, linear is better with smaller arrays and easier to set up, but binary is more effective while being harder to set up.
What are some useful tools in java.util.Arrays?
sort or parallelSort - SORTS AN ARRAY
binarySearch - SEARCHES FOR A KEY IN ARRAY
equals - CHECKS TO SEE IF TWO ARRAYS ARE EQUAL
fill - FILLS IN AN ARRAY
toString - DISPLAYS A STRING OF THE ELEMENT IN THE ARRAY