Thanks Muhammad for that tip, I shall try and put it to good use!
Brian Legg wrote:I think everyone else answered your question. 1 other thing though, when using any resources that pull/send data from a file or stream you open a connection. You should always include a finally {} block after your catch to close these connections otherwise your program could go into a never ending state of waiting for the stream to end. Your code could work 99% of the time, but the one time it doesn't get the connection and it catches the exception unless you have a finally block your program will be stuck in a never ending state.
HTH
Thanks Brian, do you mean after the last catch block I include another {} block with close() methods? I don't quite understand.