I\'m trying to read a text file and split the words individually using string tokenizer utility in java.
The text file looks like this;
a 2000
4
b
This problem is due to the fact that you don't test if there is a next token before trying to get the next token. You should always test if hasMoreTokens() before returns true before calling nextToken().
But you have other bugs :