标题: File类的delete()功能 [打印本页] 作者: LARK 时间: 2016-10-13 16:33 标题: File类的delete()功能 File类的delete()功能,如果同一路径下有同名的文件和文件夹,请问,到底会删除哪一个? 作者: 708926295@qq.co 时间: 2016-10-13 18:48
楼主这个问题很有内涵,其实我也想问。 作者: gyy 时间: 2016-10-13 19:06
api 文档中是这么写的
--------------------------------------
Deletes the file or directory denoted by this abstract pathname. If this pathname denotes a directory, then the directory must be empty in order to be deleted.
Note that the Files class defines the delete method to throw an IOException when a file cannot be deleted. This is useful for error reporting and to diagnose why a file cannot be deleted.
--------------------------------------