Introduction to Variables Flashcards
What are the 8 Primitive data types?
byte, short, integer, long, float, char, double, boolean.
what data type has values of true or false?
boolean
what data type has values of -128 to 127
byte
what data type has values of -32,768 to 32,767
short
what data type has values of -2 million to 2 million
integer
what data type has values of -9,223,372,036,854,775,808 to 9,223,372,036,854,775,808
long
what data type has values of a max of 6 to 7 decimal digits
float
what data type has values of @, *, +, a, 1, c
char
what data type has values of a max of 15 decimal digits
double
What is the difference between a primitive data type vs. reference storage?
primitive variables store the actual values.
reference variables stores the addresses of the objects they refer to.
what is the 1 reference data type?
String.
what is the syntax to declare a variable and not assign a value?
dataType variableName;
when you want to set a variable after its been declared, what do you do?
variable name = value;
In variable naming the name cannot include white space, cannot start with a number, cannot be a java reserved word, needs to be unique, and is case sensitive. What should variable naming also do?
variable naming should describe the data it holds.
how do you declare multiple variables in one statement? (asking for the syntax you would use)
dataType variableName1, variableame2
ex. String firstName, lastName