2020-02-15

Task: computer programming summarized various types of data, and calculation of its representation. Focus type conversion, numeric overflow and shift operations.
Type of computer programming data into basic data types and the reference data type. The basic data types include char (char 2 bytes), numeric, boolean (Boolean 1 byte). Wherein, into integer type Numeric (byte 1 byte, short 2 bytes, int 4 bytes, long 8 bytes) and a floating point type (float 4 bytes, double 8 bytes) . Reference data types including classes (class), an interface (interface), an array of 4 bytes for the address of the representative objects.
Note that: 1 in addition to the eight kinds of data type Boolean, and can be other conversion; 2 small to large capacity converter, known as automatic type conversion, from small to large capacity; 3 mass conversion.. to a small volume, called the cast, the program can only pass through the compiler, but may be lost during operating precision, with caution; 4 mixing operation of multiple data types, the first type data is converted into the maximum operation do; 5. in the computer, when the data to be presented exceeds computer data representation used range, overflow, data programming note value range of each data type, attention not to cause death cycle; 6 shift operation. character code for complement, << is a left shift operator >> is a right shift operator, not change the size of the operand.
Supplementary description of a shift operation: the left shift operator << 1, the left one of a number, corresponding to the number multiplied by 2; left n bits multiplied by 2 n times side, i.e., the number multiplied by the powers of the left side of the right side 2; 2:00 are positive on both sides of a right shift operator >>: a signed number the right by 1 bit, corresponding to the number by 2 (ignoring remainder); unsigned right by 2 bits, corresponding to the number is divided by 4, i.e., the number of powers of the quotient by dividing the left to the right. 2, when the digital number is smaller than the right to the left, the result is 0 (positive on both sides ) when the left of the number is less than 0, the result is: dividing the absolute value of the right side of the left 2 opposite of the powers of -1's.

发布了2 篇原创文章 · 获赞 0 · 访问量 145

Guess you like

Origin blog.csdn.net/ManWen_Li/article/details/104336256