Hello world, variables and operators Flashcards
what is the name given to a variable
the identifier
words that cannot be used as variable names
reserved keywords
byte
8 bit signed twos complement integer
default value 0
used to save space in large arrays
short
16 bit sign twos complement integer
min (-2^15)
max (2 ^16)
can also be used to save memory as is two times smaller than an int
int
32 bits
min value (-2^31)
max value(2^32)
default data type unless there is a concern about memory
long
64 bit twos complement integer
default value is 0
float
32 bit floating point default is 0.0f
mainly used to save memory in large arrays of floating point numbers
double
64 bit IEEE 754 floating point
generally default data type used for floating point number values
boolean
1 bit of information
default value is false
char
16 bit is a single 16 bit unicode character
min value is \u0000 or 0
max value is \uffff or 65,535
used to store any character
How are reference variables created
using defined constructors of classes
why are reference variables used
to access objects
Default value of a reference variable
null (as opposed to primitive data types where the default value is 0 which means you can store data with no value).
steps of using a variable
declaration - when the variable is declared
initialisation - when the variable is initially given a value
assignment - when a variable is given assignment at some point after being createed
what is a condition
an expression which can evaluate to true or false