What is Looping Statement ?
Looping statement is used to execute the block of code repeatedly as long as the specified condition is true.
Looping is used to reduce the number of lines.
Instead of writing the same code multiple times , we can use loops to perform that task efficiently.
Types of Looping Statement:
While Loop
Do While Loop
For Loop
While Loop:
While loop is used to execute the block of code until the specified condition is true.
While is used when we don't know the number of iterations of loop.
while loop is an entry-controlled loop , because it checks the condition before executing the block of code.
Syntax:
while ( condition ) { // block of code }
Enter fullscreen mode
Exit fullscreen mode
Example:
public class While_Loop {
public static void main ( String [ ] args ) {
int count = 1 ; while ( count <= 5 ) { System . out .…