15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0.0 0.5 1.0 1.5 2.0 2.5 3.0 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Repetition Java has a variety of control structures for repetition. computer science terms for repetition are looping and iteration. Fixed Repetition is done with the for loop structure. General Syntax: for (Part1; Part2; Part3) loop body; The loop has distinct parts: for initializes the Loop Control Variable (LCV). sets the exit condition for the loop. Part2 Part3 determines how the LCV changes. Specific Examples: for (k = 1; k <= 10; k++) System.out.println("Java is 10 times more fun"); Just like the if statement, use braces { } and block structure to control multiple program statements. for (k = 20; k >= 0; k- -) { System.out.println("Rocket Launch Countdown"); System.out.println( ); System.out.println("T " + k + " seconds."); System.out.println( );
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0.0 0.5 1.0 1.5 2.0 2.5 3.0 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Repetition Java has a variety of control structures for repetition. computer science terms for repetition are looping and iteration. Fixed Repetition is done with the for loop structure. General Syntax: for (Part1; Part2; Part3) loop body; The for loop has distinct parts: initializes the Loop Control Variable (LCV). Part2 sets the exit condition for the loop. Part3 determines how the LCV changes. Specific Examples: for (k = 1; k <= 10; k++) System.out.println("Java is 10 times more fun"); Just like the if statement, use braces { } and block structure to control multiple program statements. for (k = 20; k >= 0; k- -) { System.out.println("Rocket Launch Countdown"); System.out.println( ); System.out.println("T " + k + " seconds."); System.out.println( );
Text05-ControlStructures.docx