Java Do-While Loop
A do...while the circle is like a while circle, aside from that a do...while the circle is ensured to execute no less than one time
Syntax
do
{
//code to be executed
}
while(condition);
That the Boolean articulation shows up toward the finish of the circle, so the announcements on the up and up execute once before the Boolean is tried.
On the off chance that the Boolean articulation is valid, the control bounces go down to do explanation, and the announcements on the up and up execute once more. This procedure rehashes until the point when the Boolean articulation is false.
Java Do-While Loop Example:
public class my
{
public static void main(String[] args)
{
int d=1;
do
{
System.out.println(i);
d++;
}
while(d<=20);
}
}
Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
No comments:
Post a Comment