当我编译这段代码时,我目前正在学习 Java I/O:
import java.io.File;
public class Main {public static void main(String[] args){
//Creation of the File object
File f = new File("test.txt");
System.out.println("File absolute path : " + f.getAbsolutePath());
System.out.println("File name : " + f.getName());
System.out.println("Does it exist ? " + f.exists());
System.out.println("Is it a directory? " + f.isDirectory());
System.out.println("Is it a file ? " + f.isFile());
}
问题是f.exists()
并f.isFile()
返回false
这怎么可能呢 ?