Operator:
1) assignment Operator: =
2) arithmetic operator: +-*/%,++,--
3) relational operator: >,<,>=,<=,==,!= Boolean
4) logical operator: &&,| |,! Boolean
5) String Join operator: +
1. Assignment Operator: =
int a = 5; Assign 5 to integer variable a
A = a+10; Remove the value of a of 5, plus 10, and then assign a value to a
Increase by 10 on the basis of a itself
System.out.println (a); Output 15
Double price = 600.0; Consumption amount
Price = price*0.8; Call 80 percent
SYSTEM.OUT.PRINTLN (price); Output 480.0
2. Arithmetic operators: +,-, *,/,%,++,--
* 1)/: Divide two integers, result or integer, decimal place unconditional Discard
* 2)%: modulo/take-over, remainder 0 is divisible
* 3) ++/--: self-increment 1/auto-subtract 1, can also be after variable before variable
* 3.1) When used alone, there is no difference before and after
* 3.2) When used, there is a difference in the previous
* The value of a++ is a
* The value of ++a is a+1
The use of/*//arithmetic operations
int a=5,b=5;
1) Output a--value 5
2) a self minus 1 becomes 4
System.out.println (a--); 5
System.out.println (a); 4
1) Output--b value 4
2) b auto minus 1 becomes 4
System.out.println (--b); 4
System.out.println (b); 4
*/
/*
* 3. Relational operators:
* 1) > (greater than),< (less than)
* >= (greater than or equal to), <= (less than or equal to)
* = = (equals),! = (not equal to)
* 2) The result of the relational operation is a Boolean type,
* The relationship is true, the relationship is not valid is False
*/
/*
int a=5,b=10,c=5;
Boolean B1 = a>b;
System.out.println (B1); False
System.out.println (C<B); True
System.out.println (A>=C); True
System.out.println (A<=B); True
System.out.println (A==C); True
System.out.println (A!=C); False
*/
Use of logical operators &&, | |,!
Requirements
1) && (4 kinds), | | (4 kinds),! (2 types)
4 Kinds: true+false,false+true
True+true,false+false
2 Kinds: True,false
2) The 6 symbols that must be used for the relational operation
3) Use of && | | The short circuit
More exciting after the update, reprinted annotated!
java-operator and simple application