Saturday 9 November 2013

how to write byte into file in java

import java.io.*;
class writebyte
{
           public static void main(String a[])
           {
              int i =0;
             byte arr[]={'t','a','n','m','a','y'};
              FileOutputStream outfile=null;
              try
              {
                  outfile=new FileOutputStream("tanmay.txt");
                  outfile.write(arr);
                  outfile.close();
              }
              catch(IOException e)
              {
                 System.out.println(e);
                 System.exit(-1);
              }
           }
    }

No comments:

Post a Comment

How to change Background color by selecting color from Listview

activitymain.xml file::> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     xm...