File
Category:java.io
The File
class in Java is a representation of a file or a directory pathname. Methods within this class allow you to manipulate and work with different files, change names, and change directory paths.
Method Details
File
public File(String filename)
This is the constructor of the File
object that allows you to specify a filename of type String
.
Parameters
Name | Type | Description |
---|---|---|
filename | String | the name of the file |
Examples
File myFile = new File("filename.txt");