Raw data types and expressions

Source: Internet
Author: User

1. Data type: Refers to a set of data and the set of operations that can be performed.

Raw data types in 2.java:

①int

---domain:-2 31 ~ 231

②dounle

---Double-precision real number (64-bit)

---operator: && (with), | | (OR),! (non), ^ (XOR)

③char

---characters (16-bit)

3. Expressions

① Operator Precedence: * and/and% priority higher than + and-; the higher the priority, the earlier the operation.

② logical operator Precedence:! > && > | |

4. Type conversion

Attention:

① If the information is not lost, the value is automatically promoted to the advanced data type, for example: 1+2.5 = 1.0 + 2.5; The answer is 3.5.

② converting a floating-point type to an integer will truncate the fractional part, not rounding, the type conversion in complex expressions can be complex, and you should be careful and use type conversions as much as possible, preferably by using only the same type of literals and variables in the expression.

5. Compare

6. Other primitive types

① a 64-bit integer with its operator lang.

② a 16-bit integer with its operator short.

③ 16-bit characters, and their operators, Char.

④ a 8-bit integer, and its operator, byte.

⑤ a 32-bit single-precision real number and its arithmetic operator, float.

Raw data types and expressions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.