JAVA IO - deleteOnExit

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

If there is to delete the file, otherwise do not do what

import java.io.File;


public class FileDelete {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		File file = new File("c:\\work\\test");
//		if(!file.exists()){
//			System.out.println("No such file");
//		}else{
//			if(file.delete()){
//				System.out.println("Delete OK");
//			}else{
//				System.out.println("Delete wrong");
//			}
//		}
		
		file.deleteOnExit();
	}

}



Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Ian at January 18, 2014 - 8:56 AM