Arithmetic operators, relational operators, logical operators, bitwise operators for Java

Source: Internet
Author: User
Tags arithmetic operators bitwise operators

The Java operator is divided into four categories:

Arithmetic Operators , Relational Operators , logical Operators , bit operators.

Arithmetic operator: +-*/% + +--

Relational operators: = = = = > >= < <=

Logical operator:&& | |  ! ^ & |

Bitwise operator:& | ~ ^ >> << >>>

****************************************************************

Java Basic data type:

Integer: Byte, short, int, long

Non-integral type: double, float

Non-numeric type: char[characters], boolean[Boolean]

***************************************************************

One: Arithmetic operators:

?: the arithmetic operator operand must be a numeric type .

Is divided into a unary operator and a two-tuple operator;

Unary operator with only one operand;

The binary operator has two operands, and the operator is between two operands.

Unary operators: Positive ' + ', minus '-', self-adding ' + + ', self-subtraction '--' these four.

The "+ +" and "--" operators, which allow only variables of numeric type, are not allowed in expressions;

"+ +" and "--" can be used before or after a numeric variable;

Difference between two uses:

"+ +" and "--" before the numeric variables, in the assignment operation, the value of "+ +" or "--" action variable values first added 1 or minus 1, and then do other operations;

After the "+ +" and "--" are used for numeric variables, in the assignment operation, the value of the operation variable of "+ +" or "--" is first used for other operations, and then the value is added 1 or minus 1.

Arithmetic operators, relational operators, logical operators, bitwise operators for Java

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.