Arithmetic operators for Java operators

Source: Internet
Author: User
Tags arithmetic operators

First lists all the arithmetic operators

Step Two:

Precautions:

When we use arithmetic operators, remember that the following things are important:

1. The addition operator should be aware that when connecting strings, it is only possible to add strings directly to the string.

2. Division "/" when the two sides are integers, take the integer part, the remainder. When one side is floating-point, divide by normal rule.

      3."%" is the divisible-by-remainder symbol, and the fractional remainder is meaningless. The result symbol is the same as the remainder symbol.

4. integer do dividend, 0 can not do divisor, otherwise error.

      

What is the difference between the self-increment (decrement) operator above and the previous and subsequent variables?

  • Used alone:
    • Put it in front and back of the variable, just like the example above
  • Participate in the operation using:
    • Put in front of the variable, increment or decrement it first, and then participate in the operation.
    • At the back of the variable, first participate in the operation, and then self-increment or decrement.

Examples:

Arithmetic operators for Java operators

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.