Java do while loop:-
If we want to execute loop body at least once then we should go for the do-while loop.
Syntax:-
do
{
body
} while (b);
Where; the semicolon is mandatory and b always should be a boolean type.
1. The arguments should be a boolean type. If we are trying to provide any other type then we will get compile time error.
example:
int b=10;
do
{
body
} while (b);
Compile Time Error: Incompatible Type
Found: int
Required: boolean