Jen Baby Java basic notes operator

Source: Internet
Author: User
Tags arithmetic operators logical operators

1. Assignment operator =
Variable name = expression;
Assigns the value of the expression to the right of the equal sign to the variable to the left of the equals sign
2. Arithmetic operator +-*/% + +--
+ + Add and re-operate before the first
+ + at the back of the first operation in the self-added
Compound assignment operator
+= -= *=  /=  %=
sum+=5; equal to sum=sum+5;
3. Relational operators (comparison operators)
> < >= <= = = =!
The relational operator must finally derive a Boolean value (True,false)
4. Logical operators
&& (and) the expression is all true, the result is true, and the reverse is false
If there is an expression of false, the result is false, short-circuiting immediately, no subsequent expressions are executed
& (no short circuit)
|| The (or) expression has a true, the result is true, and the inverse is false
If there is an expression of true, the result is true, short-circuiting immediately, without executing the subsequent expression
| (no short circuit)
The (inverse) expression is true, reverse is false
5. Three mesh operator
(conditions)? Expression 1: Expression 2
When the condition is true, run expression 1, false when you run expression 2.
6. Operator Precedence
Highest priority: ()
Lowest Priority: =
Priority level:! > Arithmetic operators > Relational operators > && > | |

Jen Baby Java basic notes operator

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.