Java Common operation symbols

Source: Internet
Author: User
Tags arithmetic operators logical operators

  • Arithmetic operators
    • Arithmetic operators are primarily used for basic arithmetic operations such as addition, subtraction, multiplication, division, etc.
  • Assignment operators
    • An assignment operator is a symbol that specifies a numeric value for a variable or constant. If you can use "=" to assign the result of the right expression to the left operand.
  • Comparison operators
    • The comparison operator is used to determine the size of two data, for example: greater than, equal to, not equal to. The result of the comparison is a Boolean value (True or false).
  • logical operators
    • Logical operators are primarily used for logical operations.
    • 1, with : All is true, just for true

      2, or : One is true, then true

      3, non : True logic non-operation is false, false logic non-operation is true

      4, xor : There is only one true, then true

    • "Short-circuit phenomenon" in Java: The logical value of the entire logical expression can be determined, the short-circuit
      • Logical expression 1 && logical expression 2: If logical expression 1 is false, logical expression 2 does not execute
      • Logical Expression 1 | | Logical expression 2: logical expression 2 does not execute if the logical expression is 1-bit true
  • Conditional operators
    • The conditional operator (? :) also known as the ternary operator.
    • Syntax form: boolean expression? Expression 1: Expression 2
    • Operation procedure: Returns the value of expression 1 If the value of the Boolean expression is true , otherwise returns the value of expression 2
  • operator's [priority] issue
    • Level 1 has the highest priority, and level 11 has the lowest priority.

Java Common operation symbols

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.