CS Awesome - Unit 6 Vocabulary (copy)

studied byStudied by 3 people
0.0(0)
learn
LearnA personalized and smart learning plan
exam
Practice TestTake a test on your terms and definitions
spaced repetition
Spaced RepetitionScientifically backed study method
heart puzzle
Matching GameHow quick can you match all your cards?
flashcards
FlashcardsStudy terms and definitions
Get a hint
Hint

Array

1 / 11

flashcard set

Earn XP

Description and Tags

Arrays

12 Terms

1

Array

can hold many items (elements) of the same type. You can access an item (element) at an index and set an item (element) at an index.

New cards
2

Array Declaration

allows the user to specify the type of elements that will be stored in the array, then ([]) to show that it is an array of that type, then at least one space, and then a name for the array. Examples: int[] highScores; String[] names;

New cards
3

Array Creation

allows the user to type the name and an equals sign then use the new keyword, followed by a space, then the type, and then in square brackets the size of the array (the number of elements it can hold). Example: names = new String[5];

New cards
4

Array Index

allows the user to access and set values in an array

New cards
5

Array Initialization

allows the user to set the values in the array when you create it. In this case you don't need to specify the size of the array, it will be determined from the number of values that you specify. Example: int[] highScores = {99,98,98,88,68};

New cards
6

Array Length

the number of elements an array can hold. Example: given int[] scores = {1,2,2,1,3,1};, scores.length equals 6.

New cards
7

Class Method

A method that can be called on the class. It is declared using the static keyword. An example is Math.abs(-3).

New cards
8

Element Reference

A specific element can be referenced by using the name of the array and the element's index in square brackets. Example: scores[3] will return the 4th element (since index starts at 0, not 1). To reference the last element in an array, use array[array.length - 1]

New cards
9

For each Loop

Used to loop through all elements of an array. Each time through the loop the loop variable will be the next element in the array starting with the element at index 0, then index 1, then index 2, etc.

New cards
10

Out of Bounds Exception

An error that means that you tried to access an element of the array that doesn't exist maybe by doing arr[arr.length]. The first valid indices is 0 and the last is the length minus one.

New cards
11

for

starts both a general for loop and a for-each loop. The syntax for a for each loop is for (type variable : array). Each time through the loop the variable will take on the next value in the array. The first time through the loop it will hold the value at index 0, then the value at index 1, then the value at index 2, etc.

New cards
12

static

used to create a class method, which is a method that can be called using the class name like Math.abs(-3).

New cards

Explore top notes

note Note
studied byStudied by 2 people
274 days ago
5.0(1)
note Note
studied byStudied by 430 people
800 days ago
5.0(4)
note Note
studied byStudied by 25 people
35 days ago
5.0(3)
note Note
studied byStudied by 3468 people
647 days ago
4.7(18)
note Note
studied byStudied by 11 people
903 days ago
4.0(2)
note Note
studied byStudied by 45 people
837 days ago
5.0(2)
note Note
studied byStudied by 260 people
110 days ago
5.0(2)

Explore top flashcards

flashcards Flashcard (33)
studied byStudied by 4 people
700 days ago
5.0(1)
flashcards Flashcard (23)
studied byStudied by 9 people
473 days ago
5.0(1)
flashcards Flashcard (35)
studied byStudied by 11 people
34 days ago
5.0(1)
flashcards Flashcard (33)
studied byStudied by 16 people
35 days ago
5.0(1)
flashcards Flashcard (30)
studied byStudied by 60 people
504 days ago
5.0(1)
flashcards Flashcard (50)
studied byStudied by 4 people
646 days ago
5.0(1)
flashcards Flashcard (28)
studied byStudied by 29 people
654 days ago
5.0(1)
flashcards Flashcard (163)
studied byStudied by 163 people
361 days ago
5.0(1)
robot