
Figure A.1: A UNIX file under Windows
464
Appendix A
Figure A.2: The same file after LeL rewrote it
Flow of Control
Java has all the usual statements for tests and loops: if/else, switch/case,
for, while, and do/while. Multiple statements are grouped with the { and }
characters. Java also supports exceptions to report error conditions (see the
section entitled “Exceptions”).
1. The following example loops through the lines in the input file and
prints them in the output file:
for(String line = reader.readLine();
null != line;
line = reader.readLine())
writer.println(line);
EXAMPLE