This data type is used for storing whole numbers. It can be useful for the following:
Keeping a score or tracking points
Representing lives in a video game
Basically anything that does not involve halves or decimal numbers
Integers can also be used in mathmatical operations, like adding, subtracting, multiplication, and division. However, be warned that integers cannot store anything other than a whole number, so if your answer results in a non-whole number value, the decimal will be chopped off and the resulting value will be inaccurate.
Creating Integers:
Integers can be created in Java like this:
int number = 2;
"int" represents the integer variable type. "number" is the name of the variable. It has been set equal to 2.
Calculating precise values
Working with fractions
Representing temperature and measurement.