Units 1, 2, and 3 AP CS A

0.0(0)
studied byStudied by 2 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/34

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

35 Terms

1
New cards
Integer
A primitive data type that stores an integer number from -2,147,483,648 to 2,147,483,647
2
New cards
Double
A primitive data type that stores a decimal number with high precision
3
New cards
Class
defines a new data type. It is the formal implementation, or blueprint, of the attributes and behaviors of the objects of that class.
4
New cards
parseInt( )
A method in java that takes the numerical value out of a string and converts that to an integer
5
New cards
Object
a specific instance of a class with defined attributes. Objects are declared as variables of a class type.
6
New cards
Constructors
code that is used to create new objects and initialize the object's attributes.
7
New cards
New
keyword used to create objects with a call to one of the class's constructors.
8
New cards
Instance Variables
define the attributes for objects.
9
New cards
Methods
define the behaviors or functions for objects
10
New cards
Dot (.) operator
used to access an object's methods.
11
New cards
Parameters
The values or data passed to an object's method inside the parentheses in the method call to help the method do its job.
12
New cards
Return values
values returned by methods to the calling method.
13
New cards
immutable
String methods do not change the String object. Any method that seems to change a string actually creates a new string.
14
New cards
Wrapper Classes
classes that create objects from primitive types, for example the Integer class and Double class.
15
New cards
Boolean
A primitive data type that stores a true or false value
16
New cards
Casting a Variable
Changing the type of a variable using (type) name
17
New cards
Modulo
The % operator which returns the remainder from one number divide by another
18
New cards
String
Used to declare a variable of type String which is a sequence of characters or text
19
New cards
length()
returns the number of characters in a String object.
20
New cards
substring(int from, int to)
returns the substring beginning at index from and ending at index (to -1). The single element substring at position index can be created by calling substring(index, index + 1).
21
New cards
substring(int from)
returns substring(from, length()).
22
New cards
indexOf(String str)
returns the index of the first occurrence of str; returns -1 if not found.
23
New cards
equals(String other)
returns true if this (the calling object) is equal to other; returns false otherwise.
24
New cards
compareTo(String other)
returns a value < 0 if this is less than other; returns zero if this is equal to other; returns a value > 0 if this is greater than other.
25
New cards
int abs(int)
Returns the absolute value of an int value (which means no negatives).
26
New cards
double abs(double)
Returns the absolute value of a double value.
27
New cards
double pow(double, double)
Returns the value of the first parameter raised to the power of the second parameter.
28
New cards
double sqrt(double)
Returns the positive square root of a double value.
29
New cards
double random()
Returns a double value greater than or equal to 0.0 and less than 1.0 (not including 1.0!).
30
New cards
(int)(Math.random()*range) + min
moves the random number into a range starting from a minimum number. The range is the (max number - min number + 1). For example, to get a number in the range of 5 to 10, use the range 10-5+1 = 6 and the min number 5: (int)(Math.random()*6) + 5).
31
New cards
conditional
Used to execute code only if a Boolean expression is true.
32
New cards
DeMorgan's Laws
Rules about how to distribute a negation on a complex conditional.
33
New cards
if (Boolean expression)
used to start a conditional statement. This is followed by a statement or a block of statements that will be executed if the Boolean expression is true.
34
New cards
else
used to execute a statement or block of statements if the Boolean expression on the if part was false.
35
New cards
else if (Boolean expression)
sed to have 3 or more possible outcomes such as if x is equal, x is greater than, or x is less than some value. It will only execute if the condition in the 'if' was false and the condition in the else if is true.