Professional Documents
Culture Documents
A variable
• named memory location whose value can vary
• Temporary storage of data
• is a symbol which works as a placeholder for
expression or quantities that may vary or change
• symbolic name for (or reference to) information
Can hold different
numeric or alpha
numeric values.
Naming conventions
maxHealthAvailableForDamageIncrease.897_12
criticalRateMultiplierForStandardNumbers_001
Naming conventions
Do not use reserved words as variable names
Reserved words is a word that cannot be used as an
identifier(name)
• short: 16-bit signed integer. Can hold values from -32,768 to 32,767.
• long: a 64-bit integer. Can hold really big numbers (-2^63 to 2^63–1).
Data types [primitive]
byte num1 = 24
short myPoint = 345
int userAge = 18
long urLDR = 9999994547
Data types [primitive]
• Float - this data type accepts number with a decimal point. The value
of the float ranges from 1.4013 x 10-45 to 3.4028 x 10+38
• Double - this data type accepts number with a decimal point and its
value ranges from 4.9407 x 10-324 to 1.7977 x 10+308
Data types [primitive]
Precision describes the level of exactness in a number's digits.
float a = 1.55
double b = 1.3543
Data types [primitive]
The CHAR data type stores character data in a
fixed-length field.