/* Create A File and Write String of Byte (Byte Array) using FileOutputStream*/
import java.io.*;
class OutputStreamDemo1
{
public static void main(String[] args)
{
try
{
File f1=new File("MyFile.txt");
FileOutputStream fout=new FileOutputStream(f1);
byte[] byte_arr=new byte[10];
String str="Java File Handling";
byte_arr=str.getBytes();
fout.write(byte_arr);
}
catch(Exception e)
{
}
}
}



Posted in:
0 comments:
Post a Comment