<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Tech-Recipes - Latest Comments in Java switch/case statement syntax | Java programming | Tech-Recipes</title><link>http://tech-recipes.disqus.com/</link><description>Cookbook of Tech Tutorials</description><language>en</language><lastBuildDate>Tue, 08 Sep 2009 17:40:29 -0000</lastBuildDate><item><title>Re: Java switch/case statement syntax | Java programming | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/#comment-16214088</link><description>since you are using characters try using '  ' (Single quotes) instead of using " "  double quotes</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">mohd</dc:creator><pubDate>Tue, 08 Sep 2009 17:40:29 -0000</pubDate></item><item><title>Re: Java switch/case statement syntax | Java programming | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/#comment-14610320</link><description>You cannot use strings on Swithc, you can only use int.  So, it would be a better idea to capture the lettes ascii code and evaluate your switch accordingly.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">estiven</dc:creator><pubDate>Mon, 10 Aug 2009 21:55:10 -0000</pubDate></item><item><title>Re: Java switch/case statement syntax | Java programming | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/#comment-13810547</link><description>import java.io.*;&lt;br&gt;import java.net.*;&lt;br&gt;public class SvowelDPS&lt;br&gt; {&lt;br&gt;	public static void main(String args[]) throws Exception&lt;br&gt;	{&lt;br&gt;		DatagramSocket ds=new DatagramSocket(40000);&lt;br&gt;		byte rb[]=new byte[100];&lt;br&gt;		System.out.println("Connection");&lt;br&gt;		&lt;br&gt;		DatagramPacket dp=new DatagramPacket(rb,rb.length);&lt;br&gt;		ds.receive(dp);&lt;br&gt;		System.out.println("Receive Data:"+new String(dp.getData()));&lt;br&gt;		String str=new String(dp.getData());&lt;br&gt;		String res="";&lt;br&gt;		str=str.trim();&lt;br&gt;		switch(str)	//error on this point.How can i do?&lt;br&gt;		{&lt;br&gt;			case "a":&lt;br&gt;				res=("Vowel");&lt;br&gt;				break;&lt;br&gt;			case "A":&lt;br&gt;				res=("Vowel");&lt;br&gt;				break;&lt;br&gt;			case "e":&lt;br&gt;				res=("Vowel");			&lt;br&gt;				break;&lt;br&gt;			case "E":&lt;br&gt;				res=("Vowel");&lt;br&gt;				break;&lt;br&gt;			case "i":&lt;br&gt;				res=("Vowel");&lt;br&gt;				break;&lt;br&gt;			case "I":&lt;br&gt;				res=("Vowel");&lt;br&gt;				break;&lt;br&gt;			case "o":&lt;br&gt;				res=("Vowel");&lt;br&gt;				break;&lt;br&gt;			case "O":&lt;br&gt;				res=("Vowel");&lt;br&gt;				break;&lt;br&gt;			case "U":&lt;br&gt;				res=("Vowel");&lt;br&gt;				break;&lt;br&gt;			case "o":&lt;br&gt;				res=("Vowel");&lt;br&gt;				break;&lt;br&gt;			default:&lt;br&gt;				res=("Not Vowel");&lt;br&gt;				break;&lt;br&gt;		}&lt;br&gt;		&lt;br&gt;		InetAddress cipadd=dp.getAddress();&lt;br&gt;		int cport=dp.getPort();&lt;br&gt;		byte sb[]=new byte[100];	&lt;br&gt;		sb=res.getBytes();&lt;br&gt;		DatagramPacket dpsend=new DatagramPacket(sb,sb.length,cipadd,cport);	&lt;br&gt;		ds.send(dpsend);&lt;br&gt;		System.out.println("Data send")	;&lt;br&gt;	}&lt;br&gt;    &lt;br&gt;    &lt;br&gt;}</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ktk</dc:creator><pubDate>Sun, 02 Aug 2009 11:25:01 -0000</pubDate></item><item><title>Re: Java switch/case statement syntax | Java programming | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/#comment-12805715</link><description>Inside the switch case program is it possible to access another program? how?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Akila</dc:creator><pubDate>Fri, 17 Jul 2009 05:37:32 -0000</pubDate></item><item><title>Re: Java switch/case statement syntax | Java programming | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/#comment-11075768</link><description>Im a new learner of java. This example of switch case helped me to understand the syntax clearly. The program also provided more knowledge.  I will visit this site whenever i get doubt.Thanks. Good work.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Irene</dc:creator><pubDate>Thu, 18 Jun 2009 00:57:41 -0000</pubDate></item></channel></rss>