operators are special symbols that are used primarily for mathematical functions, some types of assignment statements, and logical comparisons.
Public class test{//Create Class
/**
* Assignment Operator: The assignment operator is denoted by the symbol "=", and its function is to assign the right operand to the left operand.
* arithmetic operators: arithmetic operators to sign "+ (plus)", "-(minus)", "* (multiply)", "/(except)", "% (redundancy)" means that these operators are familiar, see the following usage is good.
* Self-increment and decrement operators: the function of the self-increment and decrement operators is to increase the value of the variable by 1 or minus 1, and the operation data must be a XXX or floating-point variable.
* Comparison operators: The comparison operator is denoted by the symbol "> (greater Than)", "< (less than)", "= = (equals)", ">= (greater than equals)", "<= (less than equals)", "! = (unequal)".
* I believe this is also a look at everyone to understand, to note that the result of the comparison operator is a Boolean, set to True, otherwise false.
* Logical operators: Logical budget pay with symbols "&&, & (with, note here are two symbols can be used)", "| | (OR) ","! (non) ".
* The data for the logical operator operation must be Boolean, as shown in the following code.
*/
Public static void Main (string[] args) {//Main method
int number1 = 1; declares an int variable and assigns a value of 1
int number2 = 2; declares an int variable and assigns a value of 2
int number3 = number2 + number1;//Here is the arithmetic operator, this time Number3 will be equal to 3, operator substitution, you understand.
int number4 = 12 10;//Here is the remainder, here nunber4 will be equal to 2, understand it.
++number1 (--number1); The self-increment operator is used here, which means that the number1 is added (minus) 1 before the variable number1 is used.
number1++ (number1--); Indicates that after using the variable number1, the number1 is then added (minus) 1.
Boolean RESULT1 = number1<number2;//The comparison operator is used here, or false if it is set to true.
//The following is a logical operator, which means, The representative means that either side of the set is true and is not set to false.
Boolean result2 = ((number1<number2) | | (Number2>number1));
}
}
PS: If you have a knowledge of the binary system, you can learn the "bit operation" by Baidu itself.
<java Basics > Operators <7>