File类 文件名不要后缀

好恐怖呀,用file类的delete()删除的文件,都不会进入回收站。。。相当于shift+delete,而且连提示都没有!

用substring可以获取文件的名字,不带后缀!!
File file = new File(path);
String name = file.getName();
name=name.substring(0, name.length()-4);

见夏Python手册 http://www.vshmily.com
原文地址:https://www.cnblogs.com/zkingz/p/5958265.html