Input and Output

A

Read all lines from a text file one line at a time print each line to the screen.

B

Modify Exercise A so that you provide as argument the file to read. Also, add reasonable exception handling.

C

Modify Exercise B such that it is possible to write to the file. Add line numbers to each line that is written to file.

Extra Assignments

E1

Write to a file a single variable of each of the basic type. Close the file. Open the file again and read the data and print it to the screen. Check that the values read are the same as the values written.

E2

Use the File class to implement a directory lister. The name of the directory must be provided as an argument. For each item in the directory print if it is a file, a directory, a symbolic link, etc.