Decision statements. - They can use logic to arrive at desired results Decision statements - They can use logic to arrive at desired results - They can go in loops over and over until they come to the end of a specified group of numbers - There are four or more types of decision statements - they can be nested (one inside another or so)
For Loops For loops have 4 parts - Often For Loops are inside a method for ( int i = 1; i < 5; i ++) { System.out.println( i ); } 1) Initialize the variable 2) The Boolean test 3) the statements to perform 4) increment or decrement - Then go/loop back to the Boolean test and repeat - Continue looping until the variable gets a“false” at the Boolean test - stop immediately and continue to the program’s next step.
class ForLoopExample {. public static void main(String args[]) class ForLoopExample { public static void main(String args[]) { for(int i=10; i>1; i--) { System.out.println("The value of i is: "+i); } } }