Post ++ Operator details

Source: Internet
Author: User
1 package mycomesh; 2 public class preandpost {3 Public static void main (string [] ARGs) {4 int I = 15; 5 I = I ++; 6 system. out. println ("I ++ assignments to I"); 7 system. out. println (I); 8 // note that the result is 15 instead of 16 9 // The above example goes through the following steps 10 // int temp = I; 11 // I + = 1; 12 // I = temp; 13 // the final result is that the I value is assigned to a temporary variable, the temporary variable is assigned back to i14 15 // both the front ++ and the back ++ Add the variable value 116 // The special point of the back ++ is to save the original value of the Variable in a temporary variable and using this temporary variable for calculation 17} 18}

 

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.