Primitives Flashcards
primitive type: byte
bits?
range?
default value?
representations?
8 bits
-128 to 127
0
Representation: Binary (0b1001), Octal (072), Decimal (1234), Hex (0x4F)
primitive type: short
bits?
range?
default value?
representations?
16 bits
-32768 to 32768
0
Representation: Binary (0b1001), Octal (072), Decimal (1234), Hex (0x4F)
primitive type: int
bits?
range?
default value?
representations?
32 bits
-2147483648 to 2147483648
0
Representation: Binary (0b1001), Octal (072), Decimal (1234), Hex (0x4F)
primitive type: long
bits?
range?
default value?
representations?
64 bits
-92233720368547000 to 92233720368547000
0 or 0L
Representation: Binary (0b1001), Octal (072), Decimal (1234), Hex (0x4F)
primitive type: float
bits?
range?
default value?
representations?
32 bits
- 4E-45 to 3.4028235E+38
- 0F
Representation: Normal (123.4), Exponential (1.234E2)
primitive type: double
bits?
range?
default value?
representations?
64 bits
- 9E-324 to 1.7976931348623157E+308
- 0
Representation: Normal (123.4), Exponential (1.234E2)
primitive type: char
bits?
range?
default value?
representations?
16 bits
0 to 65535 (unicode set)
\u0000
Character (‘A’), ASCII (‘\101’), Unicode (‘\u0041’), Escape (\t, \b, \n, \r, \f, ', ", \)
What primitive type is expected when performing arithmetic on bytes, shorts, or chars?
int
When performing arithmetic on primitives and all participants are bigger than an int, what primitive data type will the result be?
The largest participant in the arithmetic expression.
What types can work with a switch statement?
byte, short, int, char, String, enum