-
Website
http://www.tech-recipes.com/ -
Original page
http://www.tech-recipes.com/rx/668/java-switchcase-statement-syntax/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
davak
83 comments · 1 points
-
Web Design
3 comments · 1 points
-
danishbacker
9 comments · 1 points
-
flexinfo
11 comments · 1 points
-
Tonychelle
4 comments · 1 points
-
-
Popular Threads
-
Facebook: How To Get Only Status Updates on Your FB Home Page
1 week ago · 4 comments
-
Firefox: Enable Case Sensitive Searches When Using Find (Ctrl+F)
4 days ago · 1 comment
-
Windows 7: How To Disable Live Preview for Taskbar Thumbnails
1 week ago · 2 comments
-
Gmail: How to block a sender from your inbox
3 weeks ago · 3 comments
-
Our first iPhone game GreenThumb available in the App Store
3 weeks ago · 2 comments
-
Facebook: How To Get Only Status Updates on Your FB Home Page
import java.net.*;
public class SvowelDPS
{
public static void main(String args[]) throws Exception
{
DatagramSocket ds=new DatagramSocket(40000);
byte rb[]=new byte[100];
System.out.println("Connection");
DatagramPacket dp=new DatagramPacket(rb,rb.length);
ds.receive(dp);
System.out.println("Receive Data:"+new String(dp.getData()));
String str=new String(dp.getData());
String res="";
str=str.trim();
switch(str) //error on this point.How can i do?
{
case "a":
res=("Vowel");
break;
case "A":
res=("Vowel");
break;
case "e":
res=("Vowel");
break;
case "E":
res=("Vowel");
break;
case "i":
res=("Vowel");
break;
case "I":
res=("Vowel");
break;
case "o":
res=("Vowel");
break;
case "O":
res=("Vowel");
break;
case "U":
res=("Vowel");
break;
case "o":
res=("Vowel");
break;
default:
res=("Not Vowel");
break;
}
InetAddress cipadd=dp.getAddress();
int cport=dp.getPort();
byte sb[]=new byte[100];
sb=res.getBytes();
DatagramPacket dpsend=new DatagramPacket(sb,sb.length,cipadd,cport);
ds.send(dpsend);
System.out.println("Data send") ;
}
}