Subscribe to Get Free Material Updates!
Visit my new blog WebData Scraping - Web Scraping Service provider company in India.

Java FileOutputStream Example



/* 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)
  {

  }

 }
}

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes