An operator of type File f = new File(file); does not create a file on disk. The java.io.File class represents only the path to the file, not the actual file on disk.
To create a new file, open FileOutputStream for it, which you can then use to write data to the file.
OutputStream out = new FileOutputStream("C:\\Temp\\filename.dat"); try { // Write data to 'out' } finally { // Make sure to close the file when done out.close(); }
source share