<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DO-while loop in java | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/do-while-loop-in-java/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Thu, 16 Feb 2023 11:51:31 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>Do-while loop in java</title>
		<link>https://studentprojects.in/software-development/java/do-while-loop-in-java/</link>
					<comments>https://studentprojects.in/software-development/java/do-while-loop-in-java/#respond</comments>
		
		<dc:creator><![CDATA[Shubhajna Rai]]></dc:creator>
		<pubDate>Thu, 16 Feb 2023 11:51:30 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[DO-while loop in java]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=10228</guid>

					<description><![CDATA[<p>The do-while loop is a control flow statement in Java that is similar to the while loop, but with a slight difference in its execution. The basic syntax of a do-while loop in Java is as follows: The difference between a do-while loop and a while loop is that the statements inside a do-while loop</p>
<p>The post <a href="https://studentprojects.in/software-development/java/do-while-loop-in-java/">Do-while loop in java</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>The do-while loop is a control flow statement in Java that is similar to the while loop, but with a slight difference in its execution. The basic syntax of a do-while loop in Java is as follows:</p>



<pre class="wp-block-code"><code lang="java" class="language-java">do {
   statement(s);
} while (condition);</code></pre>



<p>The difference between a do-while loop and a while loop is that the statements inside a do-while loop are executed at least once, even if the condition is false. The condition in the do-while loop is a boolean expression that is evaluated after each iteration of the loop. If the condition is true, the loop will continue to execute; otherwise, it will exit the loop.</p>



<p>For example, the following do-while loop will print the numbers from 1 to 10:</p>



<pre class="wp-block-code"><code lang="java" class="language-java">int i = 1;
do {
   System.out.println(i);
   i++;
} while (i &lt;= 10);</code></pre>



<p>The do-while loop is useful when you want to execute the statements inside the loop at least once, even if the condition is false. For example, consider a scenario where you want to keep asking the user for input until they enter a valid number. You can use a do-while loop to achieve this:</p>



<pre class="wp-block-code"><code lang="java" class="language-java">Scanner sc = new Scanner(System.in);
int number;
do {
   System.out.print("Enter a number: ");
   number = sc.nextInt();
} while (number &lt; 0);</code></pre>



<p>In conclusion, the do-while loop in Java is a control flow statement that is similar to the while loop, but with a slight difference in its execution. The statements inside a do-while loop are executed at least once, even if the condition is false. The do-while loop is useful in scenarios where you want to execute the statements inside the loop at least once, but with a certain condition that needs to be met in order to continue the execution. Understanding when and how to use do-while loops is an important aspect of programming in Java.</p><p>The post <a href="https://studentprojects.in/software-development/java/do-while-loop-in-java/">Do-while loop in java</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/java/do-while-loop-in-java/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
