You realise that StringTokenizer is regarded as legacy code and the API advises you against using it in new code? Use a Scanner to read the input stream and try its next() and nextXXX() and hasNextXXX() methods.
You cannot return one word at a time from a method, because a method only ever returns one thing (or void). You would have to set up a loop in the calling method and return some signal value, maybe null, to signify the end of input. Rather iffy design, I think. Maybe easier to add the words to a List<String> and return the List, which the calling method can investigate to its heart's content.
Scanner would definitely work, and probably be a lot easier than trying ot use a BufferedReader object, but I think we are supposed to use readers. He drew a UML diagram for us before we started the project and there were two Reader classes: WordReader and CharacterReader. CharacterReader was really easy because of the BufferedReader's read() function. WordReader is turning out to be a little more tricky.
I will, however, try what you are suggesting Campbell; thanks for the help.
Joined: Oct 13, 2005
Does it say on the UML diagram whether those classes use or extend other classes?
Beware of the read() methods which appear to read a single character; they don't quite do what you think. They will for example read return and new line.