1.true and False
1.1 If--else If--else, while, Do--while uses the true and false of conditional expressions to determine the execution path.
1.2 Java does not allow numbers to be judged as true or FALSE, C and C + + may not be 0.
2.math.random ()
- Produces a double value [0, 1] including 0, excluding 1.
3.foreach syntax
- If the for (float x:f) {} f is an array, the method of returning an array can be used with the foreach
4.return
- Return causes the current method to exit and return a value.
- Any method except the constructor has a return value type such as void Fun (), a String fun (), a void fun (), does not need to write a return, the default is return, the other method must have a return value (or the expression produces a value)
5.break and Continue
- Break terminates the current owning layer loop and exits the loop, continue terminates the current owning layer loop and enters the next loop.
5.1 Tags: use when you want to jump out of nested loops
ContinueLeab;//jump to the loop where the label is located, and notice that I does not increase in the inner loop ,//Break Leab; jump out of the loop where the label is, no longer loops, and the inner layer I will not increaseLeab://No other code can be added between the label and the iteration body for(j = 0; J < 5; J + +) {System.out.println (Outside); for(; i < ten; i++) { if(i = = 6) { ContinueLeab; //Break Leab;} System.out.println ("Nei"); } }
6. Switch (value)
Switch // Case 1:SYSTEM.OUT.PRINTLN (1); Break ; Case 2:system.out.println (1); Case ' A ': System.out.println (97); Break // Char ' A ' is automatically converted to ASCII value }
Java programming thought note Fourth chapter control the execution process