Data type | Used for | Min. value | Max. value | Example literals | Explained in video* | |||
---|---|---|---|---|---|---|---|---|
short | integer number | -32768 | +32767 | (short) 11 | (short) 0 | (short) 12345 | Lesson 242 | |
int | integer number | ≈ -2 billions | ≈ +2 billions | -1234 | 0 | 15_622 | Lesson 22 | |
long | integer number | ≈ -9E18 | ≈ +9E18 | -1000L | 0L | 5_000_000_000L | Lesson 242 | |
float | floating point number | ≈ 3.4E-38 | ≈ 3.4E+38 | -2.5f | 0.0f | 123.456f | Lesson 242 | |
double | floating point number | ≈ 1.8E-308 | ≈ 1.8E+308 | -2.5 or -2.5d | 0.0 | 3.45678 | Lesson 35 | |
boolean | truth value | true | false | Lesson 79 | ||||
char | unicode character | 'a' | 'Z' | '\t' | '\\' | Lesson 241 | ||
byte | sequence of 8 bits (a bit is 0 or 1) |
-128 | 127 | (byte) -42 | (byte) 0 | (byte) 123 | Lesson 242 |