File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
src/com/codefortomorrow/advanced/chapter14/examples Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 1
1
package com .codefortomorrow .advanced .chapter14 .examples ;
2
+
2
3
import java .io .*;
3
4
4
5
public class FileIO {
@@ -12,17 +13,15 @@ public static void main(String[] args) throws IOException {
12
13
in = new FileInputStream (file );
13
14
out = new FileOutputStream ("names_upper.txt" );
14
15
int c ;
15
- while ((c = in .read ()) != -1 )
16
- out . write ( Character .toUpperCase ((char )c ));
17
-
16
+ while ((c = in .read ()) != -1 ) out . write (
17
+ Character .toUpperCase ((char ) c )
18
+ );
18
19
} catch (IOException e ) {
19
20
System .out .println ("An IO Exception occurred." );
20
- e .printStackTrace (); // Prints error output stream.
21
+ e .printStackTrace (); // Prints error output stream.
21
22
} finally {
22
- if (in != null )
23
- in .close ();
24
- if (out != null )
25
- out .close ();
23
+ if (in != null ) in .close ();
24
+ if (out != null ) out .close ();
26
25
}
27
26
}
28
27
}
You can’t perform that action at this time.
0 commit comments