I'm trying to read integers from a file (2 integer values separated by whitespace) that the program will use as variables. The following code works correctly. I was wondering, is there an easier method to read integer values from a file and then assign the values to specific variables?
posted 11 years ago
That's pretty straightforward. If you're on JDK 1.4 or later, you can replace StringTokenizer with String.split() to tighten things up a bit. Test with some incorrect input, see what happens now and decide what you want to have happen:
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi