CHAPTER 87 — The File Class

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to home page   go to next page        

created: 06/24/00; revised: 07/09/02

CHAPTER 87 — The File Class

Often a program operates on a disk file as a whole―renames it, checks if it exists, deletes it, or alters its properties. These operations are performed by using the methods of the class File. The class is also used for working with directories.

Chapter Topics:

  • Class File
  • Constructor and Methods
  • Path Names
  • Testing if a file exists
  • Using File objects with Stream Constructors

Using the File class will greatly improve programs that read or write disk files.

QUESTION 1:

What package (do you suspect) has the definition of File?