如何删调一个文件!在线等待,急! String name="d:/temp/tmpfile";File file = new File(name);file.delete(); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 32.文件操作//file delete,new,renamepublic class FileOperator { public FileOperator() { } public static void main(String[] args) { FileOperator fileOperator1 = new FileOperator(); CmyFileOperate fileoperate=new CmyFileOperate("okdeleteme.txt");//"F:\\my_bag\\JBuilder6.0\\FileOperate_test\\deleteme.txt"// fileoperate.rename("okdeleteme.txt"); fileoperate.delete() ; }}class CmyFileOperate { String m_filemane=null;//文件名 File m_fullpath=null;//全路径 CmyFileOperate(String fullpath){ String str=fullpath; if((str.indexOf("\\")==-1)&&(str.indexOf("/")==-1)){//文件名 String s=System.getProperty("user.dir") ; this.m_fullpath=new File(s+"\\"+fullpath); this.m_filemane=fullpath; } else{//全路径 this.m_fullpath=new File(str);//当前目录F:\my_bag\JBuilder6.0\FileOperate_test this.m_filemane =this.m_fullpath .getName() ; } } public void rename(String filename){// File file=new File(this.m_fullpath); this.m_fullpath.renameTo(new File(m_fullpath.getParent() ,filename)) ; } public boolean delete(){ if (this.m_fullpath .exists()){ boolean deleteresult=this.m_fullpath.delete(); return deleteresult; } System.out.println("file not found .") ; return false; }} http://www.csdn.net/expert/topic/795/795315.xml?temp=.2226221数据库同步的巨难问题,谁解决了100分奉送,我还管他叫阿爹!! 线程问题,紧急求解!!!各位大侠们 关于字符串转数字的问题 初学者关于switch语句的问题 几道有趣的智力题,进来看看 一个简单的正则表达式 关于JButton JAVA运行环境问题 帮我看看哪里错了,运行时会报错。 用Jbuider需要电脑什么配置? 菜鸟小问题! 关于日期计算???? 请问有誰开发过分布式系统,请谈谈三层结构,特别是中间层的实现,急!!!!
//file delete,new,renamepublic class FileOperator { public FileOperator() {
} public static void main(String[] args) {
FileOperator fileOperator1 = new FileOperator();
CmyFileOperate fileoperate=new CmyFileOperate("okdeleteme.txt");//"F:\\my_bag\\JBuilder6.0\\FileOperate_test\\deleteme.txt"
// fileoperate.rename("okdeleteme.txt");
fileoperate.delete() ;
}
}class CmyFileOperate {
String m_filemane=null;//文件名
File m_fullpath=null;//全路径 CmyFileOperate(String fullpath){
String str=fullpath;
if((str.indexOf("\\")==-1)&&(str.indexOf("/")==-1)){//文件名
String s=System.getProperty("user.dir") ;
this.m_fullpath=new File(s+"\\"+fullpath);
this.m_filemane=fullpath;
}
else{//全路径
this.m_fullpath=new File(str);//当前目录F:\my_bag\JBuilder6.0\FileOperate_test
this.m_filemane =this.m_fullpath .getName() ;
}
} public void rename(String filename){
// File file=new File(this.m_fullpath);
this.m_fullpath.renameTo(new File(m_fullpath.getParent() ,filename)) ;
} public boolean delete(){
if (this.m_fullpath .exists()){
boolean deleteresult=this.m_fullpath.delete();
return deleteresult;
}
System.out.println("file not found .") ;
return false;
}
}
http://www.csdn.net/expert/topic/795/795315.xml?temp=.2226221
数据库同步的巨难问题,谁解决了100分奉送,我还管他叫阿爹!!