Create FileOutputStream object from File object - Java File Path IO

Java examples for File Path IO:FileOutputStream

Description

Create FileOutputStream object from File object

Demo Code

 
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

public class Main {

  public static void main(String[] args) {

    File file = new File("C:/Folder/demo.txt");

    try {/*w ww  .  j a  v a 2s  .c  o m*/
      FileOutputStream fos = new FileOutputStream(file);
    } catch (FileNotFoundException ex) {
      System.out.println("Exception : " + ex);
    }
  }
}

Related Tutorials