The File class of the java.io package is used to perform various operations on files and directories. To use the File class, create an object of the class, and specify the filename or directory name.