posts - 89, comments - 241, trackbacks - 0, articles - 1
   :: 首页 ::  :: 联系 :: 聚合  :: 管理

Java File创建文件夹

Posted on 2009-03-30 09:37 saobaolu 阅读(971) 评论(1)  编辑  收藏 所属分类: java基础与算法
import java.io.*;
public class FileClass{
    String sPath;
    String sFilePath;
    String sContent;
    
    
public boolean newFloder(String s){
        sPath 
= s;
        sPath 
= sPath.toString();
        File myFilePath 
= new File(sPath);
        
if(!myFilePath.exists()){
            myFilePath.mkdirs();
            
return true;        
        }

        
else return false;
    }

    
public static void main(String [] args){
        FileClass file1 
= new FileClass();
        String s 
= "F:/TEST";
        
if(file1.newFloder(s)){
            System.out.println(
"文件夹创建成功!");
        }

        
else System.out.println("文件创建失败");
    }


}


没有所谓的命运,只有不同的选择!