This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Thanks Campbell. I did change the while loop yesterday. I am not using a Scanner because I did not know about that object. This was supposed to be a simple parser to feed a database for an ancillary process that needs to run on demand (rarely). But, after reading about Scanner, I can certainly see how it can be very useful. Rather than writing:
Now I can write:
int intVal = Scanner.nextInt();
I will change my object. Thanks for your help!
Joined: Oct 13, 2005
Not only can you use a Scanner like that, but you can also, if necessary, precede that code withThat can reduce the Exception handling no end.
But beware, Scanners they have peculiar behaviour with line ends; you may occasionally need to call nextLine() and discard the result to get back in step with the entries.
In my case, I still have to test. I gave my guys a very simple way to get me data. So that they can load anytime they like. They just have to give me an int value followed by all the string values they want and then on the next int value (or at the end of all string values for the last int value), the system feeds the db and collects all the next string values associated with that int value. Make sense?