This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Don't compare strings with ==, use equals() method. That's the main bug in your program. Or you might consider equalsIgnoreCase(), if you really want "b" to match "B".
Another bug is that you call nextToken() twice in a row, without checking hasMoreTokens() in between. If a line has only one token, you'll get an exception there, which I suspect is not what you want. [ January 23, 2008: Message edited by: Peter Chase ]
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Joined: Aug 18, 2006
Hi Peter, the '==' case was the issue...... loads of thanks...the problem is solved
Just to be sure, you are aware that the javadoc of StringTokenizer contains the following sentence?
StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead.