Java operator (translated from Java tutorials)

Source: Internet
Author: User

From http://www.cnblogs.com/ggjucheng/archive/2012/12/14/2817915.html

English from http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html

After learning how to declare and initialize variables, you may want to know how to use them. Learning Java language operators is a good start point. An operator is a special symbol that gives one, two, or three operands a specific operation and returns the result.

When we explore JavaProgramming LanguageIt is very useful to know in advance that the operator has a priority. According to the priority order, the following table lists all operators. The closer the operator to the top, the higher the priority. High-priority operators, such as lower-priority operators, are computed first. Operators of the same row have equal priority. When operators with equal priorities appear in the same expression, the rule determines which operator to calculate first. In addition to the binary operators of the value assignment operator, the value assignment operator is calculated from left to right, and the value assignment operator is calculated from right to right.

Operator priority
Operator Priority
Suffix Expr++Expr--
RMB 1 ++Expr--Expr+Expr-Expr~ !
Multiplication */%
Addition +-
Shift <>>>>
Comparison <> <=> = Instanceof
Equal =! =
Bitwise AND &
Bitwise OR ^
Or operation |
Logic and &&
Logic or |
Sanyuan ? :
Assignment = + =-= * =/= % = <<=>>>>> =

 

In most programming, some operators appear more frequently. For example, the value assignment operator "=" is far from the unsigned right shift operator">>>". For this reason, we will discuss the most common operators in the general foundation, without paying attention to the rarely used operators.

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.