There is a code in K&B that shows how to use FileWriter and FileReader to write and read the contents of a file.
The output :
abc
def
Boxes till the end....... [Square boxes]
As the read(char []dest) method reads the number of characters that is equal to the size of the declared array dest.
In the above program since of size of array is far greater than the length of the file , Using for(char c

est) { } will iterate to the length of the array instead of the lenght of the file. Hence the above code should be modified to iterate the dest[] till the size returned by the read(). Hence the code should be modified as follows.
This will now display the excat contents of the file.
This is not mentioned in the K&B errata in the site.
Hope am correct.
Thanks
Deepak