<?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>SCJP Certification &#187; break</title>
	<atom:link href="http://www.scjp-certification.com/tag/break/feed" rel="self" type="application/rss+xml" />
	<link>http://www.scjp-certification.com</link>
	<description>Sun Certified Java Programmer Certification exam essentials</description>
	<lastBuildDate>Fri, 30 Sep 2011 05:54:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>What will be the output of the following program code?</title>
		<link>http://www.scjp-certification.com/what-will-be-the-output-of-the-following-program-code.html</link>
		<comments>http://www.scjp-certification.com/what-will-be-the-output-of-the-following-program-code.html#comments</comments>
		<pubDate>Mon, 23 Nov 2009 11:59:31 +0000</pubDate>
		<dc:creator>Daisy Williams</dc:creator>
				<category><![CDATA[Java Questions]]></category>
		<category><![CDATA[break]]></category>
		<category><![CDATA[exam guide]]></category>
		<category><![CDATA[program code]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[study guide]]></category>
		<category><![CDATA[switch]]></category>

		<guid isPermaLink="false">http://www.scjp-certification.com/?p=437</guid>
		<description><![CDATA[class Ques0357{ public static void main(String[] argv){ int s = 2; switch (s) { case 1: System.out.println(&#8220;Fred&#8221;); break; case 2:...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.scjp-certification.com%2Fwhat-will-be-the-output-of-the-following-program-code.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.scjp-certification.com%2Fwhat-will-be-the-output-of-the-following-program-code.html&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><strong>class Ques0357{<br />
   public static void main(String[] argv){<br />
       int s = 2;<br />
       switch (s) {<br />
          case 1:<br />
               System.out.println(&#8220;Fred&#8221;);<br />
               break;<br />
           case 2:<br />
               System.out.println(&#8220;Fast&#8221;);<br />
           case 3:<br />
               System.out.println(&#8220;Tech&#8221;);<br />
           default:<br />
               System.out.println(&#8220;default&#8221;);<br />
       }<br />
   }<br />
}</strong></p>
<p>The break statement is used inside the code block following the <a href="http://www.scjp-certification.com/the-switch-statement.html">switch</a> statement to terminate the execution of a statement sequence. As soon as a break statement is encountered, the program control is transferred to the first line of code that follows the entire switch statement.</p>
<p>In the given program, the argument to the switch statement is an int value 2. Therefore, the program control will be transferred at the matching case label, i.e., at line number 8. As there is no break statement after line number 7, the execution of the code will continue to fall through and all the statements after line number 8 will be executed. Therefore, the execution of the program will display Fast Tech default as the output. </p>
<p>http://www.scjp-certification.com/what-is-the-for-each-loop.html</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.scjp-certification.com%2Fwhat-will-be-the-output-of-the-following-program-code.html&amp;title=What%20will%20be%20the%20output%20of%20the%20following%20program%20code%3F"><img src="http://www.scjp-certification.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.scjp-certification.com/what-will-be-the-output-of-the-following-program-code.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Switch statement</title>
		<link>http://www.scjp-certification.com/the-switch-statement.html</link>
		<comments>http://www.scjp-certification.com/the-switch-statement.html#comments</comments>
		<pubDate>Wed, 02 Sep 2009 10:54:32 +0000</pubDate>
		<dc:creator>Daisy Williams</dc:creator>
				<category><![CDATA[Java Facts]]></category>
		<category><![CDATA[branch]]></category>
		<category><![CDATA[break]]></category>
		<category><![CDATA[statement]]></category>
		<category><![CDATA[switch]]></category>

		<guid isPermaLink="false">http://www.scjp-certification.com/?p=155</guid>
		<description><![CDATA[The switch statement is a multiway branch statement. The general form of the switch statement is given below: switch(expression) {...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.scjp-certification.com%2Fthe-switch-statement.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.scjp-certification.com%2Fthe-switch-statement.html&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>The switch statement is a multiway branch statement. The general form of the switch statement is given below:</p>
<p><strong>switch(expression) {<br />
case value1://statements<br />
break;<br />
case value2://statements<br />
break;<br />
.<br />
.<br />
default:<br />
//default statements<br />
}</strong></p>
<p>The expression must be of int, char, byte, or short data type and the data type of the values specified must be compatible with the expression.</p>
<p>Each case value must be a unique literal value. Variables are not allowed as case values.</p>
<p>The execution process of a switch statement is as follows:<br />
The value of the expression is matched with each of the literal values in the case statements. If a match is found then the code sequence following that case statement is executed. If none of the values match, then the default statement is executed. </p>
<p>If the default statement is not given and no matching value is found, then no further action is taken.</p>
<p><strong>Note:</strong> The break statement is used inside the switch statement to terminate a statement sequence. When a break statement is encountered, the execution branches to the first line of code that follows the entire switch statement block.  </p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.scjp-certification.com%2Fthe-switch-statement.html&amp;title=The%20Switch%20statement"><img src="http://www.scjp-certification.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.scjp-certification.com/the-switch-statement.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

