Skip to main content

Posts

Showing posts with the label Java Looping statement| Looping Statement in Java

Looping Statement in Java.

  Firstly what is looping statement? So, looping statement are those statement which are executed more than one time repeatedly until the user want. There are Three looping Statement in Java. 1) for loop. 2) while loop. 3) do while loop. Lets understand them by their syntax. 1) for loop for loop is a control flow statement for specifying iteration, which allows code to be executed repeatedly until the user wants. Lets understand by one example:-   Here in the example we have initiated a class with name for_loop then we have main method in the main method we have for loop in that for loop we have statement in which i is initialize to 0 and i is less than 5 and i++ for incrementing the value of i. And in that for loop we have given a statement to print the value of i. Then we have completed the blocks and generated the output. 2) while loop while loop is also a control flow statement that allows code to be executed repeatedly based on the given Boolean condition. Lets understand by one e