113 Program to write data into File in Java

Code:

import java.io.*;
class WritingDemo
{
public static void main(String args[]) throws FileNotFoundException , IOException
{
FileOutputStream fos = new FileOutputStream("Enter.txt");

String data = "Coding Atharva";

byte[] b = data.getBytes();

fos.write(b);

fos.close();
}
}



Ouput:

 write data into File in Java

Previous
Next Post »