<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Java switch/case statement syntax</title>
	<atom:link href="http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/</link>
	<description>Computer and technology tutorials and guides</description>
	<lastBuildDate>Thu, 09 Feb 2012 21:01:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Reterio</title>
		<link>http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/comment-page-1/#comment-53335</link>
		<dc:creator>Reterio</dc:creator>
		<pubDate>Mon, 16 Jan 2012 20:25:08 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-53335</guid>
		<description>You do not need to use break in DEFAULT,

the best way to understand break is not to use it, eg

switch(var){
case a:
case b:
case c:
// do something
break;
case d:
// do something else
}

which means to do sth. in case of any of a,b,c but not d</description>
		<content:encoded><![CDATA[<p>You do not need to use break in DEFAULT,</p>
<p>the best way to understand break is not to use it, eg</p>
<p>switch(var){<br />
case a:<br />
case b:<br />
case c:<br />
// do something<br />
break;<br />
case d:<br />
// do something else<br />
}</p>
<p>which means to do sth. in case of any of a,b,c but not d</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shan Tabuena</title>
		<link>http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/comment-page-1/#comment-52541</link>
		<dc:creator>Shan Tabuena</dc:creator>
		<pubDate>Tue, 13 Dec 2011 10:27:47 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-52541</guid>
		<description>In arrays statement how i going to do to make the out reverse?
for example ABC
the Output is CBD.. thank you.</description>
		<content:encoded><![CDATA[<p>In arrays statement how i going to do to make the out reverse?<br />
for example ABC<br />
the Output is CBD.. thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: man-man</title>
		<link>http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/comment-page-1/#comment-33578</link>
		<dc:creator>man-man</dc:creator>
		<pubDate>Sat, 16 Jul 2011 05:29:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-33578</guid>
		<description>IS it need to Use Breaks in dEfault?</description>
		<content:encoded><![CDATA[<p>IS it need to Use Breaks in dEfault?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: man-man</title>
		<link>http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/comment-page-1/#comment-33577</link>
		<dc:creator>man-man</dc:creator>
		<pubDate>Sat, 16 Jul 2011 05:29:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-33577</guid>
		<description>IS it need to Use Breaks in dEfault?</description>
		<content:encoded><![CDATA[<p>IS it need to Use Breaks in dEfault?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shimmer_boy3</title>
		<link>http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/comment-page-1/#comment-33414</link>
		<dc:creator>Shimmer_boy3</dc:creator>
		<pubDate>Wed, 06 Jul 2011 13:40:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-33414</guid>
		<description>hmm.. h0w ab0ut    

char a; 
    a = (char)System.in.read();
        switch (a){  
   case a:
        System.out.println(&quot;Less 10% :&quot; + (x-x*0.10));
        break;
   case b:
        System.out.println(&quot;Penalty 5% :&quot; + (x+x*0.05+x));
        break;
   case c:
        System.out.println(&quot;Penalty 10% :&quot;+ (x+x*0.10));
        break;

what express&#124;0n sh0uld &#124; use??? s0 &#124;t can read the char? 0r case a case b case c???
</description>
		<content:encoded><![CDATA[<p>hmm.. h0w ab0ut    </p>
<p>char a;<br />
    a = (char)System.in.read();<br />
        switch (a){ <br />
   case a:<br />
        System.out.println(&#8220;Less 10% :&#8221; + (x-x*0.10));<br />
        break;<br />
   case b:<br />
        System.out.println(&#8220;Penalty 5% :&#8221; + (x+x*0.05+x));<br />
        break;<br />
   case c:<br />
        System.out.println(&#8220;Penalty 10% :&#8221;+ (x+x*0.10));<br />
        break;</p>
<p>what express|0n sh0uld | use??? s0 |t can read the char? 0r case a case b case c???</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nadzirah_orangeleo</title>
		<link>http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/comment-page-1/#comment-33125</link>
		<dc:creator>Nadzirah_orangeleo</dc:creator>
		<pubDate>Tue, 21 Jun 2011 06:51:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-33125</guid>
		<description>import java.util.Scanner;public class switchDemo {
      public static void main(String[] args) {
        Scanner inputDevice = new Scanner(System.in);        System.out.println(&quot;Enter a number for a month&quot;);        int iUserInput = inputDevice.nextInt();
                   switch (iUserInput) {            case 1:  System.out.println ( &quot;January&quot; );     break;            case 2:  System.out.println (&quot;February&quot;);      break;            case 3:  System.out.println (&quot;March&quot;);         break;            case 4:  System.out.println (&quot;April&quot;);         break;            case 5:  System.out.println (&quot;May&quot;);           break;            case 6:  System.out.println (&quot;June&quot;);          break;            case 7:  System.out.println (&quot;July&quot;);          break;            case 8:  System.out.println (&quot;August&quot;);        break;            case 9:  System.out.println (&quot;September&quot;);     break;            case 10: System.out.println (&quot;October&quot;);       break;            case 11: System.out.println (&quot;November&quot;);      break;            case 12: System.out.println (&quot;December&quot;);      break;            default: System.out.println (&quot;Invalid month&quot;); break;                    }}}
  </description>
		<content:encoded><![CDATA[<p>import java.util.Scanner;public class switchDemo {<br />
      public static void main(String[] args) {<br />
        Scanner inputDevice = new Scanner(System.in);        System.out.println(&#8220;Enter a number for a month&#8221;);        int iUserInput = inputDevice.nextInt();<br />
                   switch (iUserInput) {            case 1:  System.out.println ( &#8220;January&#8221; );     break;            case 2:  System.out.println (&#8220;February&#8221;);      break;            case 3:  System.out.println (&#8220;March&#8221;);         break;            case 4:  System.out.println (&#8220;April&#8221;);         break;            case 5:  System.out.println (&#8220;May&#8221;);           break;            case 6:  System.out.println (&#8220;June&#8221;);          break;            case 7:  System.out.println (&#8220;July&#8221;);          break;            case 8:  System.out.println (&#8220;August&#8221;);        break;            case 9:  System.out.println (&#8220;September&#8221;);     break;            case 10: System.out.println (&#8220;October&#8221;);       break;            case 11: System.out.println (&#8220;November&#8221;);      break;            case 12: System.out.println (&#8220;December&#8221;);      break;            default: System.out.println (&#8220;Invalid month&#8221;); break;                    }}}<br />
 </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The_Lugdog</title>
		<link>http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/comment-page-1/#comment-46582</link>
		<dc:creator>The_Lugdog</dc:creator>
		<pubDate>Tue, 22 Feb 2011 00:54:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-46582</guid>
		<description>i dont know</description>
		<content:encoded><![CDATA[<p>i dont know</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ashish Narola Rajkot</title>
		<link>http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/comment-page-1/#comment-45638</link>
		<dc:creator>Ashish Narola Rajkot</dc:creator>
		<pubDate>Tue, 18 Jan 2011 17:20:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-45638</guid>
		<description>can i use multiple choice in case of SELECT......CASE statement ? i.e.

select (expression)
{
case &quot;a&quot; or &quot;A&quot;:
system.println(&quot;vovel&quot;);
break;
case &quot;a&quot; or &quot;A&quot;:
system.println(&quot;vovel&quot;);
break;

case &quot;e&quot; or &quot;E&quot;:
system.println(&quot;vovel&quot;);
break;

default:
system.println(&quot;Ashish you r wrong.&quot;);


}</description>
		<content:encoded><![CDATA[<p>can i use multiple choice in case of SELECT&#8230;&#8230;CASE statement ? i.e.</p>
<p>select (expression)<br />
{<br />
case &#8220;a&#8221; or &#8220;A&#8221;:<br />
system.println(&#8220;vovel&#8221;);<br />
break;<br />
case &#8220;a&#8221; or &#8220;A&#8221;:<br />
system.println(&#8220;vovel&#8221;);<br />
break;</p>
<p>case &#8220;e&#8221; or &#8220;E&#8221;:<br />
system.println(&#8220;vovel&#8221;);<br />
break;</p>
<p>default:<br />
system.println(&#8220;Ashish you r wrong.&#8221;);</p>
<p>}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sajmmon</title>
		<link>http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/comment-page-1/#comment-45514</link>
		<dc:creator>Sajmmon</dc:creator>
		<pubDate>Thu, 13 Jan 2011 18:18:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-45514</guid>
		<description>If you need to switch over a value that is a string you can embed it into an Enum:

public class Example{
  enum Values { a, b, c }
  public static void main(String[] args) {
    Values v = Values.a;

    switch() {
      case a:
        //TODO
        break;
     case b:
       //TODO
       break;
     case c:
       //TODO
       break;
    }
  }
}

Regards</description>
		<content:encoded><![CDATA[<p>If you need to switch over a value that is a string you can embed it into an Enum:</p>
<p>public class Example{<br />
  enum Values { a, b, c }<br />
  public static void main(String[] args) {<br />
    Values v = Values.a;</p>
<p>    switch() {<br />
      case a:<br />
        //TODO<br />
        break;<br />
     case b:<br />
       //TODO<br />
       break;<br />
     case c:<br />
       //TODO<br />
       break;<br />
    }<br />
  }<br />
}</p>
<p>Regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Student</title>
		<link>http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/comment-page-1/#comment-44507</link>
		<dc:creator>Student</dc:creator>
		<pubDate>Sun, 05 Dec 2010 15:12:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-44507</guid>
		<description>i have the same question as kiabaman...</description>
		<content:encoded><![CDATA[<p>i have the same question as kiabaman&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached (User agent is rejected)
Database Caching 6/17 queries in 0.846 seconds using memcached
Object Caching 417/419 objects using memcached

Served from: www.tech-recipes.com @ 2012-02-10 02:40:28 -->
