Constructor | Summary |
---|---|
File(File parent, String child) | Creates a new File instance from a parent abstract pathname and a child pathname string. |
File(String pathname) | Creates a new File instance by converting the given pathname string into an abstract pathname. |
File(String parent, String child) | Creates a new File instance from a parent pathname string and a child pathname string. |
File(URI uri) | Creates a new File instance by converting the given file: URI into an abstract pathname. |
import java.io.File;
public class Main {
public static void main(String[] args) {
File file = new File("c:/aFolder/aFile.txt");
System.out.println(file);
}
}
The output:
c:\aFolder\aFile.txt
import java.io.File;
public class Main {
public static void main(String[] args) {
File parent = new File("c:/aFolder");
File aFile = new File(parent, "aFile.txt");
System.out.println(aFile);
}
}
The output:
c:\aFolder\aFile.txt
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |