Java basic 01 variables, comments and data types
1.4 common notes
/ / single line comments, from / / to the end of the line.
/**Start and end with * /.
2. Data type 2.1 basic classification
(1) basic data type
32 + 8 + 4 + 1 0010 1101
0*2^7 + 0*2^6 + 1*2^5 + 0*2^4 + 1*2^3 + 1*2^2 + 0*2^1 + 1*2^0 0 + 0 + 32 + 0 + 8 + 4 + 1 45
Absolute value converted to binary: 0010 1101 bitwise inversion: 1101 0010 plus 1:1101 0011
0)
First subtract 1:1101 0010, reverse by bit: 0010 1101 convert to decimal integer: 45 add minus sign: - 45
026 (octal)
0b010 110 (binary)
0xa3 (hexadecimal, using a ~ F to represent 10 ~ 15)
@H_ 840_ 301 @ 0b1001 1011 (binary)
0 ~ 127 => 0 ~ 2^7-1 0*2^7 + 1*2^6 + 1*2^5 + 1*2^4 + 1*2^3 + 1*2^2 + 1*2^1 + 1*2^0 0 + 64 + 32 + 16 + 8 + 4 + 2 + 1 127
-128 ~ - 1 = > - 2 ^ 7 ~ - 2 ^ 0 subtract 1 first: 0111 1111 bitwise inverse: 1000 0000 convert to decimal integer: 128 add minus sign: - 128 subtract 1:1111 1110 bitwise inverse: 0000 0001 convert to decimal integer: 1 add minus sign: - 1