If, if...else ... Statement
if (true) { System.out.println ("execute when True"); Else { System.out.println ("execute when false"); }
Switch statement
switch (a) { case 1: switch System.out.prin TLN ("perform" break ; case 2: System.out.println ( "Duty The "); break ; default : System.out.println ( "when "); break ; }
Break and continue can achieve sequential interrupts, but there are different jumps
Break: Force the program to interrupt the loop to leave the loop body;
Continue: Forcing the program to jump to the beginning of the loop, the statement after the continue statement will no longer execute, jump out of this cycle;
While statement
while (a<100) { // determine if the statement in white brackets is true, and execute the method in {} When it is true System.out.println (a); A+ +; }
Do...while ... Statement
Do { // the statement in do inside is executed first to determine if the while statement is true System.out.println (a); A+ +; System.out.println (a); while (a<100);
For loop
for (int i = 0; i < args.length; i++) { }
99 Multiplication Table
for (int i = 1; I <= 9; i++) { for (int j = 1; J <=i; J + + ) { System.out. Print (J+ "*" +i+ "=" + (i*j) + "\ T"); } System.out.println ("\ n"); }
The path of Java Learning (ii) Flow control statements