<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 >