Friday, November 17, 2017

Java Do-While Loop with Example

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 with Example


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

Top 200+ Core Java Interview Questions And Answers For 2019

Most Popular Java Interview Questions Given below is a comprehensive list of most important and commonly asked basic and advanced Java p...