I am using a method to delete a particular pre-existing file using the file.delete() method as follows
public void deleteFile(String fileName)throws IOException //To refine. Does not work
{
File file=new File("C:\\File Handling\\"+fileName+".txt");
boolean success=file.delete();
System.out.println(success);
}
However success is always returned as false. What is going wrong?
Please advise on how else to delete a file using java.