Join Peggy Fisher for an in-depth discussion in this video Managing loops, part of Java Essential Training for Students.
- Java has three types of loops.…We have a do/while, which is a post-test loop,…a while loop, which is a pre-test loop,…and a for loop, which is also a pre-test loop.…Each loop has a specific purpose.…The do/while loop executes the code at least once,…since it doesn't check the status of the condition…until after executing the code in the loop.…While loops repeat as long…as the conditional statement is true.…
In other words, the loop continues…while a condition is true.…And the for loop executes a predetermined number of times.…This type of loop should be used when you know…how many times to execute the block of code.…The for loop syntax is much different…than the while and the do/while.…It has three parts: initialization,…test condition, and the update.…This is an example program that implements…the three loops presented above.…Most of the programs we include from this point forward…contain loops so you'll see lots of examples.…
An example of a program that can make use…of the do/while loop is a program that provides…
- Getting started with parsing
- Reviewing data types
- Using decisions
- Creating user-defined methods
- Command-line debugging
- Exploring the Java API
- Creating and instantiating classes
- Working with interfaces
- Storing items with arrays
Skill Level Intermediate
1. Command Level Programming
2. Basics Review
4. Java API
5. Simulations and Algorithm Analysis
6. Classes and Objects
7. More on Classes
8. Data Structures
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.