CS 1130: Transition to OO Programming
Module 1, Part 6
Reading and Writing Files
Many applications require the ability to read and write files on the computer's hard drive. In Java, this is done using classes in package java.io. This illustrates a useful paradigm of OO programming in Java. Want to add a new kind of functionality? Write a package of classes for it. The basic language remains the same, but a new package allows you to do more. Each version of Java generally comes with more packages. Here are examples of packages:
This module consists basically of a short assignment to get you familiar with reading and writing files.
1. Lab for Reading and Writing FilesLab Instructions
Comments: This is a "lab" and not a real programming assignment. It guides you through a few steps so that you learn quickly about read and writing files. You will have to write two procedures, but they should take only 5-10 minutes each. Then, in the future, if you have to read or write a file, you will know where to look --the class that you will download from the course website.