The long data type can store integers from -2,147,483,648 to 2,147,483,647. The following code shows how we would define a long variable:
long myLong = 123,456,789;
In the preceding code, we declared a variable named myLong of the long type and gave it a value of 123,456,789. It is good practice to avoid using the long data type unless it is necessary to store larger numbers because it uses more memory than the integer type.