Third, Java basic data types + operators

Source: Internet
Author: User

Third, Java basic data types + operators

  1. Common Basic Data Types
    • Byte value range of one byte:-128 to 127
    • Short two-byte value range:-32768 to 32767
    • Int value range:-2147483648 to 2147483647
    • Long eight bytes value range :...
      • Note: The number of bytes and value range of the basic data type are calculated from-(2 ^ (byte * 8-1) to (2 ^ (byte * 8-1) to-1.
  2. Think about it:
    1. Int teest1 = 'A' + 'B ';
    2. Char Test2 = 'A' + 'B ';
    3. Char test3 = '中 ';
    • Conclusion: in Java, when char is computed, it is treated as the certificate corresponding to the ASCII code.
  3. Thoughts:
    1. Int A = 3;
    2. Int B = a + 3.4f + 5.4;
    • Conclusion: When an integer and a double operation are performed, the calculation result is automatically converted to a high-precision operation.

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.