Creating a File object - Java File Path IO

Java examples for File Path IO:File Operation

Introduction

To create a File object, you call the File constructor, passing a string representing the filename of the file as a parameter.

For example:

Demo Code

import java.io.File;

public class Main {
  public static void main(String[] arg) {
    File f = new File("myfile.txt");

  }/*from  w  w  w  .j av  a 2 s.  c  o  m*/
}

Related Tutorials