File f = new File(\"C:\\\\Temp\\\\Example.txt\");
f.createNewFile();
On executing, a new file named \"Example.txt\" will be created in the Temp>
On Linux, Mac OS X and other *nix flavours, the folder separator is /
not \
, so there isn't any need to escape anything, some/path/of/folders
.
Also, you can use the /tmp
folder for your temporary files.
Finally, on *nix systems, the home directory is usually represented by ~
or is in the environment variable HOME
.