Download presentation
Presentation is loading. Please wait.
Published byΣαναχάριβος Κοσμόπουλος Modified over 6 years ago
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); } } }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.