I'm trying to read a file in java:
Public class Test{
public static void main (String [] args) throws IOException {
BufferedReader f = new BufferedReader(new FileReader("test.in"));
//...
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("test.out")));
//...
}
}
1) Where should the location of "test.in" be? (src? bin? ???)
2) Where will "test.out" be located?
Usually it's the exact location of where the Java file you are executing is. So if you use your Java file in C:\ and you look for a file without specifying a path, it will be in C:\ that it looks, and the output file will also be in C:\
If you are using something like Netbeans however, you just have to place the file in the netbeans project folder of your specific project (the root directory folder). Not in the source or bin folders of your project.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments