Java Video 14: While Loop
Vložit
- čas přidán 7. 09. 2024
- In this video you will learn how to create and use java while loop.
A while loop does not necessarily iterate a specified number of times. Rather, as long as its control expression is true, a while loop will continue to iterate. This type of loop is very useful in situations where a for loop would be ineffective, particularly when the user is given the opportunity to interact with the program.
A while loop is considered to be an indeterminate or indefinite loop because usually only at run-time can it be determined how many times it will iterate.
A while loop is also considered to be a top-checking (or pretest) loop, since the control expression is located on the first line of code with the while keyword. That is, if the control expression initially evaluates to FALSE, the loop will not iterate even once.
After the keyword, while, a control expression is necessary.
while (control expression)
{
one or more statements
}
The control expression must evaluate to TRUE in order for the while loop to iterate.
Like if statements and other kinds of loops, the curly braces are not required with a while loop if there is only statement in the body of the loop. However, it is good style to always use curly braces.
Other videos:
Video1: How to Install NetBeans with JDK Cobundle.
www.youtube.co....
Video2: First Java application:
• Java Video 2: First Ja...
Video3: Java Variables:
www.youtube.co....
Video4: Java Arithmetic Operators
www.youtube.co....
Video5: Java Relational (comparison) Operators:
www.youtube.co....
Video6: Java Logical Operators:
www.youtube.co....
Video7: Java Scanner How to Input Data Part1
• Java Video 7: Java Sca...
Video8: Java Scanner Part2 How to input from a text file and a web page
• Java Video 8: Java Sca...
Video9: Java Methods :
• Java Video 9: Java Met...
Video10: Java If statements :
• Java Video 10: Decisio...
Video11: Java Switch case:
• Java Video 11: Decisio...
Video12: Read and Write to a File:
• Java Video 12: Read an...
Video13: For loop:
• Java Video 13: For Loop
Video14: while loop:
• Java Video 14: While Loop
Video15: do .... while loop:
• Java Video 15: do whil...
Video 16 : One Dimensional Arrays:
• Java Video 16: One Dim...
Video 17 : Strings Part1:
• Java Video 17: Java St...
Video 18 : Strings Part2 : Functions
• Java Video 18: String ...
Java Video 19: Classes and Objects
• Java Video 19: Classes...
Java Video 20: Inheritance | Abstract | Overloading | Overriding
• Java Video 20: Inherit...