Java Basics Tip < good programmer training camp >

Source: Internet
Author: User

<a href= "http://www.goodprogrammer.org/" target= "blank" >android training </a>------My Java notes and look forward to communicating with you!

1. In the For loop, if the increment is defined in the For statement, for example: for (int i=0;i<3;i++), then the variable is released by the system after the for loop has finished executing

2.break can use "label" in a loop to determine which loop to jump out of, for example

W:for (int i=0;i<3;i++) {      Q:for (int j=0;j<3;j++)    {         if (j==2)                       Break w;    }}

3.do-while () statement, performing at least one loop

4. In a function or function, a variable defined in a code block is called a local variable, and a local variable is created when a function or block of code is executed, and is destroyed at the end of a function or block of code. Local variables must be initialized or assigned before a value operation is performed, or a compilation error will occur!

5.-1% 5 =-1 1%-5 = 1 The symbol for the remainder depends only on the preceding number, but only if two numbers are integers

6. Short I=1;

i=i+1; Wrong, I is 2 bytes, 1 is 4 bytes

I+=1; Yes, automatic conversion.

7. Do not exchange a value of a, B with a third-party variable, use three-time XOR

A = a ^ b;

b = a ^ b;

A = a ^ b;

Java Basics Tip < good programmer training camp >

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.