Unit 1: CS21 Review Flashcards
what are string literals
a sequence of characters enclosed in double quotes which is assigned to a variable
data type
Determines what kind of data a variable can hold
examples of primitive data types
int, double, boolean, and *char
*not mentioned on the AP test
double is more bits than int
true
athematic expressions
expressions with int or double formed by +,-,*,/, and %
int + int
int
int + double
double
when doing mod does the big or small number go first?
big
compound expressions
expressions with multiple arithmetic operators
what is order precedence
PEMDAS
what is the assignment operator
=
what are the increment operators?
++,—
what happens when a variable is declared as final?
the value can’t be changed once it’s initialized, any attempt results in an compilation error
compound assignment operators
+=,-=,*=,=, %=
casting
process of converting a variable from one data type to another
rounding
modifies a double vale to the nearest integer value
if you cast a double to an int what hapoens
anything after the decimal point in the double is cut off (without rounding)
double rounded if positive
(int)(x+0.5)
double rounded if negative
(int)(x-0.5)
overflow
if a num surpasses the java max then it goes back the the same number. uh negative
compiler
Software that translates to Java source into the job class while what can be run on the computer
Compiler or syntax error
lAn those foundering the completion
main method
where execution starts jv a java program
compiler or syntax error
error during compile
variable
name associated with a memory location in a computer
declare a variable
spesficy the type and name
data type
Determines the size of memory reserve for a variable
camel case
One way to create a variable name by a pending several words together in uppercase the first letter of each word after the first (myScore)
operator
Common mathematical symbols
what happens if you attempt to divide an integer by zero?
The arithmetic exception error occurs
the