DAY05----operators in the Java language
First, the operator Overview:
The use of operators is used in every development language, and there are different usage rules in different languages. With the operator we can think of the MySQL database operators, these are similar, perhaps some in use is not the same. Here's a look at the operators in Java.
Second, Operator:
1. Arithmetic operators:
Mainly include: Add, subtract, multiply, divide, take surplus (%), self-add (+ +), self-reduction (--)
2. Assignment operators:
is the equal sign (=)
3, Bitwise operators:
Mainly includes:&, |, ~, ^, <<, >>, >>>
4. Comparison operators:
Mainly includes:>, >=, <, <=, = =
5. Logical operators:
Mainly includes:&&, &, | |, |,! ^
Iii. Precedence of Operators
| operator Description |
operator |
| Separator |
. [ ] ( ) { } , ; |
| Monocular operator |
+ +--~! |
| Forcing type conversion operators |
(type) |
| Multiply, divide, and seek redundancy |
* / % |
| Add, Subtract |
+ - |
| Shift Operators |
<< >> >>> |
| Relational operators |
< <= > >= instanceof |
| Equivalence operators |
== != |
| Bitwise-AND |
& |
| Bitwise XOR OR |
^ |
| Bitwise OR |
| |
| Conditions and |
&& |
| Conditions or |
|| |
| Trinocular operation |
?: |
| Assign value |
= + = = *=/= &= |= ^=%= <<= >>= >>>= |
Iv. examples
Package www.dzx.c1; public class OPerators {public static void main (string[] args) {//judgment positive even int a = 10;if (a>0 && a%2==0) {System.out . println ("This number is a positive even!") ");} else {System.out.println ("This is not even!") ");};/ /Judging leap years int year = 2004;if (Year%400==0 | | (year%4==0 && year%100!=0)) {System.out.println (year+) is a leap year! ");} else {System.out.println (year+) is not a leap year! ");} Self-increment and decrement int b = 20; System.out.println (b++); System.out.println (++B); System.out.println (b--); System.out.println (--b);}}
V. Concluding remarks:
Here we have learned the operator, you have to use it in the instance to continue to use, constantly to review.
This article from "Lonely One Night" blog, reproduced please contact the author!
----operators in the Java language