AP Computer Science A - Standard Java Classes & Basic Functions + Variables

0.0(0)
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/9

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

10 Terms

1
New cards

Random Number Formula

(int)(Math.random() * numOfPossibleValues + startingNumber)

2
New cards

Random Number Function Range

0 - 0.999…

3
New cards

Empty 1D Array Construction

type[] arr = new type[size]

4
New cards

Full 1D Array Construction

type[] arr = {0,1,2,3…}

5
New cards

Function to get the amount of elements in 1D Array

arr.length; (Think that b/c it can’t expand, that therefore its a variable and not a function)

6
New cards

ArrayList Construction

ArrayList<Type> arrList = new ArrayList<Type>();

7
New cards

Read Element Data of ArrayList

arrList.get(index);

8
New cards

Function to get the amount of elements in arrayList

arrList.size();

9
New cards

Order Of Operations for Selection Sort (1st pass only - 3 Steps)

1) Grab First element

2) Iterate through rest and find smallest

3) Swap with first element

10
New cards

Order Of Operations for Insertion Sort (1st element - 6 Steps)

1) Grab first element

2) Compare to the next.

3) If next is lower, overwrite data of first data with next.

5) Repeat until next isn’t higher.

6) Replace current element with first element value.