do-while Loop in Java


A do-while loop ensures the code inside the loop runs at least once before checking the condition.

Source Code

int count = 1;
do {
    System.out.println("Count is: " + count);
    count++;
} while (count <= 5);
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments