Java IO Tutorial - Java FileOutputStream.finalize()








Syntax

FileOutputStream.finalize() has the following syntax.

protected void finalize()   throws IOException

Example

In the following code shows how to use FileOutputStream.finalize() method.

/*  w  ww .j av  a 2  s  .c  om*/
import java.io.FileOutputStream;

public class Main extends FileOutputStream {
  public Main() throws Exception {
    super("C://test.txt");
  }

  public static void main(String[] args) throws Exception {

    Main fosa = new Main();

    // read byte from file input stream
    fosa.finalize();


  }
}