Ben initially coded the openOutputFile() from Listing 2.3 as follows. What do you think of this implementation?
```
33 public void openOutputFile( String outfileName ) {
34 try{
35 outfile = new Formatter( outfileName );
36 } catch ( FileNotFoundException e ) {
37 System.err.printf( "Error opening output file: %s\n%s",
38 outfileName, "Exiting application." );
39 } catch ( SecurityException e ) {
40 System.err.printf( "Error insufficient write access to " +
41 "create file: %s\n", outfileName );
42 }
43 finally {
44 infile.close();
45 System.exit( 1 );
46 }
47 }
```
There is nothing incorrect with the implementation, but it could be argued that exiting (line 45) is a bit drastic. An alternative is to dispose of the finally clause (lines 43 – 46) so that when an exception is thrown, the method is exited right away and the caller gets to decide what to do. For example, the caller may be able to ask the user for a different file name and retry the openOutputFile() operation.
You might also like to view...
Which of the following is a characteristic of dry pipe fire suppression systems?
a. Water held back by a clapper b. Always contains water c. Can freeze in winter d. Most popular and reliable
The special parameter "$@" is referenced twice in the out script (page 989). Explain what would be different if the parameter "$*" were used in its place.
What will be an ideal response?