Beginning Java 7 Horton - try/catch vague
The last patagraph on page 288 in Structuring a Method and the following example is vague in its terseness (IMHO).
Its is not clear if the author is stating that for example if 2 sequencial statements (each capable of throuwing an exception) should have separate back to back try/catch blocks as opposed to one which catches for what might be very different exceptions?
Or simmilarly if those 2 statements might have an simple non-exception statement like incrementing a value just read, or writing a line to a log etc.in between the exception-possible lines, should be pulled from its logical location and be sandwiched between 2 try blocks?
I think a better example and maybe a few more words in text would make sure were are following Ivor's advice without possibly over crowding code - would help.
Last edited by wa2nfn; March 24th, 2013 at 12:33 PM..
|