返回列表 發帖
本帖最後由 蔡庭豪 於 2018-6-9 11:11 編輯
  1. package bbs.istak.org.tw;

  2. import java.io.File;
  3. import java.io.IOException;

  4. public class Main {

  5.         public static void main(String[] args) {

  6.                 File file = new File("D://fake frank//fuck up.txt");
  7.                
  8.                 if(!file.exists()){
  9.                        
  10.                         String path = file.getParentFile().getPath();
  11.                         File newfile = new File(path+"//fuck up.txt");
  12.                         newfile.getParentFile().mkdirs();
  13.                         try {
  14.                                 newfile.createNewFile();
  15.                         } catch (IOException e) {
  16.                                 // TODO 自動產生的 catch 區塊
  17.                                 e.printStackTrace();
  18.                         }
  19.                        
  20.                 }
  21.                
  22.                
複製代碼

TOP

返回列表