您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

Introduction

Content

Apply

Reflect

Extend

previous.gif
 (3087 bytes)next.gif
 (2959 bytes)


Content Index

Content Page # 25

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

basicline.gif (169 bytes)

RITSEC - Global Campus
Copyright ?1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg