Java tutorial
//package com.java2s; import java.io.File; import java.io.IOException; public class Main { public File createSDFile(String fileName) throws IOException { File file = new File(fileName); if (!file.exists()) { file.createNewFile(); } return file; } public static File createSDFile(String dir, String fileName) { File file = new File(dir + File.separator + fileName); try { file.createNewFile(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return file; } }