Java Create a FileOutputStream

Java Create a FileOutputStream

To create a FileOutputStream in Java, you can use the following code:

FileOutputStream out = new FileOutputStream("output.txt");
Source:ww‮.w‬lautturi.com

This code creates a new FileOutputStream called out that writes to the file "output.txt". The FileOutputStream is a class that allows you to write data to a file.

You can then use the write method of the FileOutputStream to write data to the file, like this:

out.write(65); // writes the byte with the value 65 (ASCII value of 'A') to the file

It is important to remember to close the FileOutputStream when you are finished writing to the file, to release any resources that it is using. You can do this using the close method, like this:

out.close();
Created Time:2017-11-03 00:14:38  Author:lautturi