public static void main(String[] args) throws IOException {
File file = new File("d.txt");//错误的 //File file = new File("H:\\d.txt");正确的
System.out.println(file.getAbsolutePath());
if(!file.getParentFile().exists()){
file.getParentFile().mkdirs();
}else{
System.out.println("oh,yse !");
}
}
错误显示:
in thread "main" java.lang.NullPointerException
at thread.Test12.main(Test12.java:22)
用File file = new File("H:\\d.txt");却正确,求指导
|
|