Presentation is loading. Please wait.

Presentation is loading. Please wait.

Decision statements. - They can use logic to arrive at desired results

Similar presentations


Presentation on theme: "Decision statements. - They can use logic to arrive at desired results"— Presentation transcript:

1 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)

2 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 ) 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.

3 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); } } }


Download ppt "Decision statements. - They can use logic to arrive at desired results"

Similar presentations


Ads by Google