Here you can find the source of createNewFile(String filepath)
public static File createNewFile(String filepath) throws IOException
//package com.java2s; import java.io.File; import java.io.IOException; public class Main { public static File createNewFile(String filepath) throws IOException { return createNewFile(new File(filepath)); }/*w w w . j a v a 2s . c o m*/ /** * create a new blank file * @param file * @return * @throws IOException */ public static File createNewFile(File file) throws IOException { File pareFile = file.getParentFile(); if (pareFile.exists() || pareFile.mkdirs()) { File newFile = file; if (newFile.exists() || newFile.createNewFile()) return newFile; } return null; } }