In this section, you will learn how to Updates to a file to the Disk in java.
Forcing Updates to a File to the Disk
In this program we are going to update a file forcefully. Firstly we have to make an object of OutputStream and pass a file name in which you want to update in the constructor of a FileOutputStream class. After that pass some data to the stream. The methods we are using in this class has already been discussed in other topics.
Code of the program is given below:
import java.io.*;
|
Output is given below:
C:\ForcingUpdates>java ForcingUpdates Congrats you have entered the text forcefully |