The data type specifies the size and type of information the variable will store:
Data Type | Size | Description |
---|---|---|
int |
4 bytes | Stores whole numbers, without decimals |
float |
4 bytes | Stores fractional numbers, containing one or more decimals. Sufficient for storing 7 decimal digits |
double |
8 bytes | Stores fractional numbers, containing one or more decimals. Sufficient for storing 15 decimal digits |
boolean |
1 byte | Stores true or false values |
char |
1 byte | Stores a single character/letter/number, or ASCII values |
Practice Excercise Practice now