Java-operator and judgment

Source: Internet
Author: User
Tags true true

Operator:
1) arithmetic operator: +-*/%,++,--

Add, subtract, multiply, divide, take remainder, self-increment, self-subtract
2) relational operator: >,<,>=,<=,==,!= Boolean type

Determine the value of two shaping or floating-point sizes to be Boolean

3) logical operator: &&,| |,! Boolean type

&&: Short-circuit and (and), both sides are true, see false False if the 1th number is false, a short circuit occurs (the latter is not executed)
| |: Short circuit or (or), one side is true, see true True if the 1th number is true, a short-circuit occurs (the back is not executed)
!: logical non (take reverse), non-true false, not false then true

4) Assignment operator: =,+=,-=,*=,/=,%=

Assigning a value of the corresponding type to a variable
5) String Join operator: +
6) Three mesh operator: Boolean number 1: Number 2

Boolean number 1: Number 2
  
To calculate the Boolean value:
If true, the result of the entire expression is 1 if false, the result of the entire expression is 2


Branching structure: Conditional execution of a statement, not every sentence must go
1) If:1 Road
2) If...else:2 Road
3) If...else if: Multiple paths
4) Switch...case: multiple routes
Advantages: High efficiency, clear structure
Cons: Integers, equals
Break: Jump out of switch

I am a beginner, if the update is not good, welcome the Great God pointed out, thank you!

More exciting after the update, reprinted annotated!

Java-operator and judgment

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.