try
{
if(!(new File("D:/java/newdata/").isDirectory()))
{
new File("D:/java/newdata/").mkdir();
new File("D:/java/newdata/2003-04-14/").mkdir();
}
else
{
new File("D:/java/newdata/2003-04-14/").mkdir();
}
}
catch(SecurityException e)
{
System.out.println("can not make directory");
}
File myFile = new File("D:/java/newdata/2003-04-14/myfile.txt ");
FileOutStream fos = new FileOutStream(myFile);
用fos.write("你要写入的内容");
创建文件夹和文件的java代码范例
最新推荐文章于 2020-09-29 17:53:23 发布