Java’s iteration statements are for, while, and do-while. These statements create what we commonly call/oops. As you probably know, a loop repeatedly executes the same set of instructions until a termination condition is met. As you will see, Java has a loop to fit any programming need.
The while loop is Java’s most fundamental looping statement. It repeats a statement or block while its controlling expressionis true. Here is its general form: . while(condition) body of loop.