We'll help you get started with our revised beginner's tutorial , or our free online textbook. For more permanent storage, computers use files , which are collections of data stored on a hard disk, on a floppy disk, on a CD-ROM, or on some other type of storage device. A directory can hold other directories, as well as files. Both directories and files have names that are used to identify them.
Programs can read data from existing files.
They can create new files and can write data to files. In Java, such input and output is done using streams. Human-readable character data is read from a file using an object belonging to the class FileReader , which is a subclass of Reader . Similarly, data is written to a file in human-readable format through an object of type FileWriter , a subclass of Writer . However, FileInputStream and FileOutputStream are used in an exactly parallel fashion.