Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of JavaLessons.com

Essence

We use java.util.StringTokenizer to split a string into its different parts , delimited by whitespace :

--- spaces, tab characters, newlines, etc .

As long as the string contains elements,....

we extract each next one.

The cast to String is necessary, because nextElement returns an Object reference, not a String reference.

To let StringTokenizer use your own delimiters, you can pass a second argument, this one specifying a dot and an at-sign as delimiters. You can enumerate delimiting symbols, but only as shown, in one single String.

.