本帖最后由 Sword 于 2013-5-10 20:34 编辑
package day20;
import java.io.*;
public class FileDemo {
public static void main(String[] args) throws IOException {
method();
consMethod();
}
public static void consMethod()
{
File f=new File("demo.txt");
sop(f.getPath());
File f1=new File("E:\\MyEclipseTest\\Test\\a.txt");
File f2=new File("E:\\MyEclipseTest\\Test\\a.txt","E:\\MyEclipseTest\\Test\\b.txt");
sop("f1:"+f1);
sop("f2:"+f2);
//sop("delete:"+f1.delete());
}
public static void sop(Object obj)
{
System.out.println(obj);
}
public static void method() throws IOException
{
File f=new File("E:\\MyEclipseTest\\Test\\file.txt");
sop("creat"+f.createNewFile());
}
}
//为什么会提示creatfalse |