//练习一:在当前模块下的aaa文件夹中创建一个a.txt文件

public class Test06 {
    public static void main(String[] args) throws IOException {
        
        File file = new File("untitledOne\\aaa");
        if (!file.exists()) {
            //如果文件不存在,就创建出来
            file.mkdirs();
        }
        File newFile = new File(file, "a.txt");
        newFile.createNewFile();
    }
}

 

posted @ 2024-03-28 15:58  冷风5997  阅读(80)  评论(0)    收藏  举报