day02 Summary

Data type conversion

  1, automatic type conversions

        byte,short,char-->int-->long-->float-->double

        (1) byte and the byte, short and short, char and char operation, upgraded int

        (2) byte and short, byte char and mixing operation, upgraded int

        (3) mixing all types of operation, automatically upgraded to the largest type

        (4) Boolean not participate in any type of conversion

        (5) Once all types "+" stitching and string, are the result string

  2, cast

       double-->float-->long-->int-->byte,short,char

          (1) risk, may overflow or loss of precision

        (2) the small memory may need to cast a large range of types

        (3) Boolean not participate in any type of conversion

        (4) string does not participate in cast

Operators

  First, arithmetic operators

     + (Plus), - (minus (), *, /,%, + (plus), - (negative), +, -

  Second, the assignment operator

     Basic operators: =

     Extended operator: + =, - =, / =, = ........ *

  Third, the comparison operator

      The results are only two expressions, true and false, usually as a condition

  Fourth, the logical operators

      &、|、^、!、&&、||

  V. conditional operator

      Conditional expression? The resulting expression 1: Expression 2 results

  Six, bitwise operators

    (1) left <<: left several times, the equivalent of several square multiplied by 2

    (2) >> right: the right times, divided by 2 is equivalent to several parties (up to see what is left of the most significant bit)

    (3) >>> unsigned right: the difference between right and, regardless of why the highest, left several missing several fill 0

    (4) & Bitwise AND: all 1 1

    (5) or bit /: 1 of 1

    (6) ^ bitwise XOR: 1 is different from

    (7) bitwise ~: every inversion, becomes 0 becomes 0 1,1

Guess you like

Origin www.cnblogs.com/zzz222zzz/p/11495366.html