Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Java can obtain a file reference located in the src directory using the following code:

File file = new File("src/filename.txt");

This creates a File object with the pathname of the file located in the src directory. The file can then be accessed for reading or writing.