AP classes
Notes: Computer Science A 10/26/13 For loops Run a set of commands a set number of time While loops Run a set of commands as many times as a given condition is true Do?while (Same as while except it always runs once) For(inti=0;i<10;i++) { Same.out.println(i); } -10 -9 -7 -6 -5 -4 -3 -2 -1 For(i=0;i<10;i--) -0 -2 -4 -6 -8 -10 For(int I;intList) { System.out.print(i); } Int i=0; While(I<10) { //code I++; } 10/17/13 Chapter 5 Notes (Java Essentials) EXAMPLE 1: If (condition) Statement 1; Condition has to be true = statement 1 executed EXAMPLE 2: If (Condition) Statement1; Else Statement 2; Condition =true, statement 1 executed; otherwise statement 2 is executed EXAMPLE 3: If (condition1) Statement1; Else if (condition2) Statement 2; Else Statement 3;