Java Foundation easy to mix Point

Source: Internet
Author: User

1. Binary conversion from low to High: Byte<short (char) <int<long<float<double

2.java Eight basic data types (in the Stack): integer type Byte,short,int,long,

Floating-point type float,double

Character type Char

Boolean Type Boolean True,false

--------------------------------------------------------

String is a reference type, capitalized (exists in heap)

3. int res = 20;  String str = "result is:"; System.out.println (str+res+20);//The result is: 2020 System.out.println (str+ (res+20));//Result: 40

4. The difference between i=i+1 and i+=1 short i = 1; i = i+1; System.out.println (i);//Error short i = 1; i + = 1; System.out.println (i);//i=2; The first right of I first becomes the integer and 1 Add, then assigns to the left I, but the left I is the short type, the precision cannot be from high to the end self-

Moving, so error The second I always be short type, so the accuracy is unchanged, no error

5.&& and & Difference A&&b A is false, then no longer judge B, directly return False a&b A is false, will also judge B, and finally return False | | and | is similar to a| | b A is true, does not judge B, directly returns True A|b A is true, it will also Judge B, and finally returns true

^ for XOR or that is, a true one false, returns true; same return false

6. Bitwise operator binary number The first bit indicates that symbol 0 is positive 1-bit negative >> right-shift arithmetic positive left complement 0, negative left complement 1 >>> unsigned right Shift right, left full complement 0

7. Computer internal data are binary forms exist in the binary system in the computer there are many ways to exist: The original code: 3:0000 0011 The first bit is the sign bit, 0-bit positive, 1-bit negative anti-code: Positive inverse code and the same as the original code, negative anti-code, retain the first bit sign, the rest of the counter -3:1000 00 11 (original code)-->1111 1100 (anti-code) * Complement: Positive anti-code, the original code and complement are the same, the complement of negative numbers = anti-code +1; -3:1000 0011 (original code)-->1111 1100 (anti-code)-->1111 1101 (complement) The calculation and the internal operation of the binary is the complement

Java Foundation easy to mix Point

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.