What is the purpose of the File class in Java?

What is the Purpose of the File Class in Java?

The File class in Java is used to represent file and directory pathnames in an abstract manner. It provides methods to:

1. Create, delete, and rename files and directories.

2. Check file properties (like existence, readability, writability).

3. List contents of directories.

4. Get file size, path, and other metadata.