String Tokenizer in Java doesn’t work
Asked By
10 points
N/A
Posted on - 10/01/2011

I created a java program. For the I want to split sentence to different words and put them into a array.
I used following two codes for that. But, it doesn't work.
Help me for solve this. Thank you!
String[] result = "John Steve Smith".split(s);
for (int x=0; x<result.length; x++)
System.out.println(result[x]);
StringTokenizer st = new StringTokenizer("John Steve Smith");
while (st.hasTokens()) {
System.out.println(st.next());
}
