File f = new File("C:\\Temp\\Example.txt");
f.createNewFile();
On executing, a new file named "Example.txt" will be created in the Temp
folder. How do I provide the file path in Mac OS X?
I tried providing:
File f = new File("\\Users\\pavankumar\\Desktop\\Testing\\Java.txt");
f.createNewFile();
But it didn't work for me.
Forward slash "/" must be used to get the file path here. Use:
File f = new File("/Users/pavankumar/Desktop/Testing/Java.txt");
f.createNewFile();