Using the StringTokenizer class

This little java code example shows the principle of the StringTokenizer class. If you want to devide a String that has substrings divided with a separator you create a new instance of the class and send the string as the first argument and the devider as the second argument.
You loop through it by calling the hasMoreTokens() method which returns true until there are no more tokens left.
In this example we just print out each token on a new line.
The output of the example is:

Search for more Java info on this site here:
Custom Search

Please type any questions here.