Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Java default integer
Java default integer
Three kinds of integers int are 32 bits long and 64 bits short and 8 bits long.

For example, you have this system. out.println (10000);

10000 This constant virtual opportunity opens a 4-byte space for him by default, which is int.

Equivalent to this

int t = 10000;

System.out.println

Java found that an integer constant (such as that 10000) would be stored in the form of int instead of short and long.

If you write a system. out . print(2 147483648);

The editor will prompt you to enter an excessively large integer, because he will treat the integer 2 147483648 as an int, and 2 147483648 is beyond the storage range of int.

If you want to prevent him from saving constants with the default int, you must do so.

system . out . print(2 147483648 l);

So he won't prompt for too big an integer.

Because it's equivalent to

Length t =10000;

system . out . println(t);