Java IO Tutorial - Java File(String parent, String child) Constructor








Syntax

File(String parent, String child) constructor from File has the following syntax.

public File(String parent,  String child)

Example

In the following code shows how to use File.File(String parent, String child) constructor.

/*from   w  w  w .  j  a  va  2 s .c o m*/
import java.io.File;

public class Main {

  public static void main(String[] args) {
    File aFile = new File("c:/","abc.txt");
    System.out.println(aFile.isAbsolute());//false

  }
}

The code above generates the following result.