|
|
Example of interactive programs reading/writing files The following is an example of writing the content of a TextArea to a file. The program uses the PrintWriter class which allows you to pass any object as an argument.

The code can be found in FileDemo.java . FileDemoReversed.java performs the opposite operation. The user is expected to supply the name of a file and the content will be displayed in the TextArea. If you use the same file you have just created the following will be displayed. 
further examples of interactive file handling programs can be found in sections 17.4-17.12 chapter 17 of Deitel & Deitel. Back to top 
RITSEC - Global Campus Copyright ?1999 RITSEC- Middlesex University. All rights reserved. webmaster@globalcampus.com.eg |
|