do-while Loop

A loop that runs its body once before checking whether to repeat.

What is do-while Loop in Java?

do-while Loop — A loop that runs its body once before checking whether to repeat.

class Login {
    int makeOneAttempt() {
        int attempts = 0;

        do {
            attempts++;
        } while (attempts < 1);

        return attempts;
    }
}

Level: Apprentice · More Java terms at this level

Updated

In other subjects