1. There is a goto in Java, but this is only a reserved word and cannot be used (const is also). The error message in Eclipse is "Syntax error on token" goto ", throw expected".
A similar function of Goto is implemented by the break/continue tag.
(1) Break label
outer: for (int i=0; i<10; i++) { if(i = =5 )break outer ; + " "); }
Results: 0 1 2 3 4
Analysis: Break jumps through the tag to the For loop body, and then no longer enters the loop.
(2) Continue label
outer: for (int i=0; i<3; i++) { for (int j=11; j<15; j + +) { if (j = =) continue outer; + "" + j + ""); } }
Results: 0 11 0 12 1 11 1 12 2 11 2 12
Analysis: Continue jumps to the for outside through the tag, but just jumps out of the current loop and it re-enters the for loop.
2. Can I access non- static variables in the static environment ?
Eclipse Tip: Cannot make a static reference to the Non-static field
3. Identifiers and Unicode
Identifiers can consist of letters (Unicode), numbers, currency symbols (¥,$), and connection symbols (_).
This concerns Unicode, and not all Unicode can be used as part of an identifier. Also, not only numbers cannot be the first character of an identifier.
intStart = 0; intPart = 0; for(inti=0x0000; i<=0x10ffff; i++) { if(Character.isjavaidentifierstart (i)) {start++;//System.out.println (Character.tochars (i)); } if(Character.isjavaidentifierpart (i)) part++; } System.out.println ("Number of Unicode character sets:" + (0x10ffff+1)); System.out.println ("As the number of first characters:" +start); System.out.println ("As part of the identifier:" +Part ); System.out.println ("Difference between the two:" + (Part-start));
Results:
4.i++ and ++i
This is not just the first plus and after add how simple, for i++, actually I is the value of the first copy to a temporary variable, and then add 1 (like ++i), and finally participate in the operation.
int i = 1; = i++; System.out.println (i);
Results: 1
The implementation of the i++ is as follows:
int temp = i; i = i+1; return temp;
What is the result of 5.i+++j?
int i = 1, j = 3, result; = i+++J; System.out.println ("Result:" + result); System.out.println ("i =" + i); System.out.println ("j =" + j);
Results:
Analysis: Equivalent to (i++) +j. The compiler takes greedy rules and tries to find as many operators as possible (if you learn how the compilation principle can understand why).
Java Fragmentation Knowledge