Why can integer literal constants in Java be assigned to short?
Integer has 32 bits of data, and short has 16 bits of data. When short variables are declared as direct assignment, the assignment interval is -32768? 32767 can be assigned directly (-32768? 32767 is converted to binary, just occupying 16 bits). When an integer variable (or constant) is directly assigned to the short, the system will intercept the following 16 bits and assign them to the short, which may cause some data loss.