자바 생 성 파일
String strPath = "d:\\file\\a";
File file = new File(strPath);
if(!file.exists()){
file.mkdirs();
} 새 폴 더 를 만 들 고 이 폴 더 아래 에 파일 을 만 들 려 면 다음 과 같이 하 겠 습 니 다.
package image;
import java.io.File;
import java.io.IOException;
public class test {
public static void main(String[] args) throws IOException {
String strPath="d:/file/a/a.txt";
File file = new File(strPath);
File fileParent = file.getParentFile();
if(!fileParent.exists()){
fileParent.mkdirs();
}
file.createNewFile();
}
}