int
This type stores numbers in the range from -2.147.483.648 to
2.147.483.647. Every sequence of digits makes up an
int literal:
int x = 42;
int y = -123456789;
You can also use hexadecimal numbers to initialize int values. In this case you must put the prefix 0x in front of the number:
int x = 0x2a; // This is 42 in decimal
You can also use octal numbers to initialize
int variables. In this case the number
has to start with a 0:
int x = 010; // This is 8 in decimal
int values are automatically converted to double values if required. Therefore, this statement is
valid:
double x = 42;