September 2011
Beginner
650 pages
15h 47m
English
Try This 10-1 A File Comparison Utility
CompFiles.java
This project develops a simple, yet useful file comparison utility. It works by opening both files to be compared and then reading and comparing each corresponding set of bytes. If a mismatch is found, the files differ. If the end of each file is reached at the same time and if no mismatches have been found, then the files are the same. Notice that it uses the new try-with-resources statement to automatically close the files.
1. Create a file called CompFiles.java.
2. Into CompFiles.java, add the following program:

3. To try CompFiles, first copy CompFiles.java to a file called temp. Then, ...
Read now
Unlock full access