|
Do you need help with your Java programming?
Click here for instant help with your Java code. |
Delete a file
This little example shows how to delete a file from disc. |
import java.io.File; public class FileUtil { public boolean deleteFile(String filename) { File file = new File(filename); return file.delete(); } public static void main(String[] args) { FileUtil fileutil = new FileUtil(); System.out.println(fileutil.deleteFile("/temp/myfile.txt")); } } |
| Do you know your Java? | |
| Take a Ten-Question-Java-Quiz! | |
Search for code examples on this site
