Java series (4)-computing and java Series

Source: Internet
Author: User
Tags arithmetic operators bitwise operators

Java series (4)-computing and java Series

1. Operators

(1) Arithmetic Operators

   

A: +,-, *,/, %, ++ ,--

B: + usage

[A. addition]

[B. Positive id]

[C. Pay for string connection]

C: // and %

[When data is used for Division,/gets the quotient and % gets the remainder]

D: ++ and -- Usage

[A. When used separately: the results are the same as those after the operation data, and the effects of a ++ or ++ a are the same]

[B. when involved in the operation-before the operation: First Auto-increment or auto-increment, then participate in the operation]

[C. when involved in Operation operations-placed behind the operand: First involved in the operation, then auto-increment or auto-subtraction]

(2) value assignment operator

   

A: =, + =, * =,/=, % =

B: = It is called the value assignment operator.

C: Extended value assignment operator features

(3) Comparison Operators

   

A: = ,! =,>, >=, <, <=

B: No matter what operations are performed on both ends of the operator, the final result is of the boolean type.

C: Do not write = As =

(4) logical operators

   

A: &, | ,!

[&: The result is the same as &, but it has a short circuit effect. False on the left and no execution on the right]

[|: The result is the same as |, but it has a short circuit effect. True on the left and no execution on the right]

【! : False if not true, true if not false]

B: logical operators are used to connect operators of the boolean type.

(5) bitwise operators

   

A: To perform bitwise operations, first convert the data to binary.

B: &, |, ^ ,~

[&: False]

[|: True if yes]

[^: Bitwise XOR operation. If the bitwise XOR operation is the same, false is used. If the bitwise XOR operation is different, true is used]

【~ : Bitwise Inverse Operator: 0 to 1, 1 to 0]

C: <, >>, >>

[<: Left shift, left highest bit discard, right fill 0]

[>: The highest bit in the right direction is 0, the left side is 0, the highest bit is 1, and the left side is 1]

(6) ternary Operators

   

A: Format

[Comparison expression? Expression 1: expression 2]

B: Execution Process

[Calculate the value of the comparison expression first. If it is true, expression 1 is executed; otherwise, expression 2 is executed]

2. keyboard entry

3. Process Control statements

(1) The ordered results are executed from top to bottom.

(2) Select the structure and execute different codes according to different options.

(3) duplicate code in the Loop Structure

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.