Java do while loop

If you want to execute the loop at least once without condition constraint, then we can use the do-while loop.

This do-while loop will be executed once without checking the condition what is there in the while block. After completion of first execution it will be checking the condition of the while loop.

Java do while example

public class DoWhileExample {

	public static void main(String[] args) {
		int number=1;

			System.out.println("Value of the number: "+number);

Value of the number: 1