Declaring and using constants and variable Flashcards
when the value of data item cannot be changed while running a program.
Constant
___ can be refer as literal constant, numeric constant, unnamed constant or simply, hard-coded.
459
a named memory location that can store a value. It can only hold one value but the value it hold can be changed.
Variable
describes the type of data that can be stored, how much memory the item occupies and types of operation that can be perform on the data.
Data type
– is a statement that reserves a named memory location
Variable declaration
A ______ that identifies the type of data that the variable will store
data type
An _____ that is the variable’s name
identifier
begins with lowercase letter and capitalizing subsequent words within the identifier
Camel Casing
An __________ , if you want a variable to contain an initial value
optional assignment operator (=) and assigned value
contains unknown value (garbage value)
Uninitialized variable –
– to declare 2 or more variables of the same type in a single statement, it is separated by a comma.
Multiple variable declaration
the value of the location should not be changed during execution.
Named Constant
All of integer data type are signed
(+ or -)
Declaring integer data type:
- int (variable)
- byte (variable)
- short (variable)
- long (variable)
BOOLEAN DATA TYPE
Only has 2 values (true or false)