I have used this code to create an empty textfile but it only gets stored in the project folder. I want to know how to make the text file appear on desktop?
public void newFileCreator(String filename){
File ob = new File(filename + ".txt");
boolean filecreated = false;
try{
filecreated = ob.createNewFile();
}
catch(IOException e){
System.out.println("Error" + e);
}
if(filecreated = true){
System.out.println("Created empty file" + ob.getPath());
}
else{
System.out.println("Failed to create empty file" + ob.getPath());
}
}