Other points to note when computing in Java

Other points to note when computing in Java

class Arimetic
{
    
    
	public static void main(String[] args)
	{
    
    
		short x = 10;
		s1++; //或者是++s1
		System.out.println(s1); //此时输出的结果为11,特别注意的是,此时s1的数据类型并				没有改变,仍然是short的基本数据类型
	}
}

3Insert picture description here
Insert picture description here

  1. Insert picture description here

  2. Insert picture description here

  3. Insert picture description here

Insert picture description here

Insert picture description here
7. Insert picture description here
8. Insert picture description here

  1. Insert picture description here
    Insert picture description here

  2. The underlying binary of the computer is in the form of complement, so in bit operation, the complement of the number is actually calculated, but when it is converted from binary to decimal, it is converted from the original code. , And the highest bit 1 of the negative original code is not involved in the conversion calculation, it just represents a negative sign.

  3. Insert picture description here

  4. Insert picture description here

  5. Insert picture description here

Insert picture description here

Insert picture description here

  1. Insert picture description here

  2. Insert picture description here
    Combination of assignment and ternary operation.

  3. Insert picture description here

  4. Insert picture description here

Insert picture description here

  1. Insert picture description here

  2. Insert picture description here
    In the if...else statement, only one statement will be executed.

  3. Insert picture description here

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_41633396/article/details/114901865