根据语法,它是正确的,但它仍然没有删除图像文件。
try {
Calendar now = Calendar.getInstance();
File file1= new File("D:\\"+formatter.format(now.getTime()));
if(file1.delete()){
System.out.println(file1.getName()+"deleted");
}
else {
System.out.println(file1.getName()+"failed");
}
}
catch(Exception po) {
System.out.println(po);
}