convert string to an array java

Convert string like "abc,etc,sdq,sds,dse" to an array of 5 strings using java?
anup001Asked:
Who is Participating?
 
Ajay-SinghConnect With a Mentor Commented:
Use split

String[] array = "abc,etc,sdq,sds,dse".split(",");
0
 
marklorenzCommented:
You need to use a StringTokenizer with a comma as the field separator.  Check it out here:

How to break a String into tokens with the StringTokenizer class
http://www.devdaily.com/java/edu/pj/pj010006/pj010006.shtml
0
 
anup001Author Commented:
Thanks Ajay
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.