What is an int?
Below are some examples of int literals in Java:
42 110 -100
Notice int literals are just plain numbers, that optionally begin with a minus sign to indicate negative numbers, that do not contain a decimal point. They can never be fractions.
Declaration and Initialization Syntax
As for all data types, declaring and initializing an integer follows the syntax:
<type> <name> = <value>;
So, declaring and initializing int variables looks like:
int myAge = 18; int aNumber = 3; int roomNumber = 307;
Ints are most useful for counting.