Data Types and Variables
An Introduction with Examples in Java |
Prof. David Bernstein
|
Computer Science Department |
bernstdh@jmu.edu |
Type | Memory | Range |
byte
|
1 byte | -128 to 127 |
short
|
2 bytes | -32,768 to 32,767 |
int
|
4 bytes | -2,147,483,648 to 2,147,483,647 |
long
|
8 bytes | \(-2^{63}\) to \(2^{63}-1\) |
float
|
4 bytes | |
double
|
8 bytes | |
char
|
2-4 bytes | Unicode |
boolean
|
true or false |
double
)