tring.split() was introduced in jdk 1.4'
For one thing, StringTokenizer returns one substring at a time whereas the split method returns an array of substrings.
Best to use String's split(...) method. The StringTokenizer class is a legacy class (NOT deprecated)
By default, StringTokenizer uses whitespace to delimit tokens, and if there are two or more delimiter characters
in a row, it collapses them into one delimiter. So the split() equivalent would be
String result = "this is a test".split("\\s+");
But if you really want to treat each character as a separate delimiter, you just remove the plus sign again.
This is, in my opinion, the best reason to choose split(); while there is a way to do single-character delimiters in StringTokenizer, it's kludgy and awkward.
And yes, StringTokenizer is inherently faster,
StringTokenizer can split strings based on single characters, split() takes regular expressions.
I imagine that might make split() a bit slower when splitting for single characters (can't be arsed to test it
though), but usually it's more handy.