1
2
3
4
5
6
7
8
9
|
import java.io.File;
public class Test{
public static void main(String[] args) throws Exception {
File f = new File( "d:/io" );
f.mkdirs();
f = new File( "d:/io/test.txt" );
f.createNewFile();
}
} |
创建一个指定的文件和指定的目录
1
2
|
File d = new File( "D:\\io\\test.txt" );
d.createNewFile();
|