can you post some code lines to show what is in your patient.txt file?
also, you may want to investigate your code a bit further: for instance, if you don't have a patient.txt file, what do you think will happen on line 38?
since you didn't instantiate sf, you'll get a NullPointerException.
stultuske
Posting Sensei
3,137 posts since Jan 2007
Reputation Points: 1,114
Solved Threads: 433
here's your problem:
for (i = 0; i <=4; i++)
you have to understand that, since your arrays have only four elements, and since they are 0 based (first index = 0,not 0), the highest index possible = 4 - 1
for (i = 0; i < 4; i++)
well .. it may not be your only problem, but this is the first one solved anyway :)
stultuske
Posting Sensei
3,137 posts since Jan 2007
Reputation Points: 1,114
Solved Threads: 433
also isn't sf instantiated on like 23?
nope, you're setting it to null, which is not an instance.
null is the default value every Object has, when it's not yet instantiated. but since it's not an instance, you can't call any of the instance methods on it.
you instance your sf variable on line 27, but only if no exception is thrown there.
you should write your code so, that all the calls made on sf are also placed within that try block, that way you eliminate the possibility of them being called when sf is not isntantiated.
stultuske
Posting Sensei
3,137 posts since Jan 2007
Reputation Points: 1,114
Solved Threads: 433
well, your first error there, is once agian <= 4.
next to that, it looks like there's a problem with your printf's
stultuske
Posting Sensei
3,137 posts since Jan 2007
Reputation Points: 1,114
Solved Threads: 433
it's not something logically, you're printing Strings, so set s instead of d.
try this:
ps.printf("%20s %15s", arylast[i], arydob[i]);
ps.println();
stultuske
Posting Sensei
3,137 posts since Jan 2007
Reputation Points: 1,114
Solved Threads: 433