Java value assignment operator and value assignment expression

Source: Internet
Author: User

To assign values to different variables, you must use the assign operator "=". Here "=" does not mean "equal to", but "assign value". For example:

A1 = 3;

This statement is used to assign integer 3 to variable a1. Make the value of variable a1 3 at this time. Let's look at the following statement:

A1 = a1 + 1;

As you know, this representation method won't work in mathematics, but as a value assignment statement, it is often used in future programming, add the result of a1 and 1 to the a1 variable for storage. If the a1 value is 3 before the statement is executed, the a1 value changes to 4 after the statement is executed.

Sometimes we often use the following statement:

J = I = 3;

The processing method of this statement system is: first assign integer 3 to variable I, and then convert (I = 3) to a value expression. The value of this expression (calculation result) also 3. Finally, assign the value of expression (I = 3) to j. Therefore, the value of variable j is 3.

Special Recommendation for editing: Java Relational operators and relational expressions

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.