A variable is a variable value within a range.
Points:
Data type (determines the type of the variable's value)
8 bits in a byte, each bit storing 0101 such binary complement is used for data, the first bit of a byte data type is the sign bit, which indicates positive or negative.
Data type byte short int long float double char Boolean
Number of bytes 1 2 4 8 4 8 2 1
stored in the computer is the complement of data, the 1th bit is the sign bit, the complement of negative numbers equals its inverse code +1, so the range is:
-2^8~2^7-1 ....... ........
About Precision:
What precision?
When using the complement, the first bit of the first byte represents the sign bit, which represents the positive or negative, which may represent precision. Therefore, when the long data type directly using the short data type to accept the error, you may lose precision, that is, the previous byte is discarded.
The operation of the variable:
The same data type, which is for its complement operation, needs to change the accepted data type in order to get the error data when the number of complementary digits exceeds the number of in-situ numbers.
With different data types, the small data types are converted to large data types and then manipulated using large data types. The generally obtained values are of a large data type. This is an implicit conversion of variables.
Forced type conversion (large turn small)
is to intercept the large type of the following bytes so that the number of bytes is equal to the number of small bytes, so that the small range can be accepted.
The problem of casting possible loss accuracy.
Variables related to Java