Java Tutorial

 
 
 
 
import java.io.*;

class  WritingBytes
{
    public static void main(String[] args) 
    {
          //Declare and initialize  a byte array
          byte cities[] = {(byte)\'D\',(byte)\'E\',(byte)\'L\',(byte)\'H\',(byte)\'I\',(byte)\'\\n\',
            (byte)\'M\',(byte)\'A\',(byte)\'D\',(byte)\'R\',(byte)\'A\',(byte)\'S\',(byte)\'\\n\',
            (byte)\'L\',(byte)\'O\',(byte)\'N\',(byte)\'D\',(byte)\'O\',(byte)\'N\',(byte)\'\\n\'};

          //Create an output file stream
          FileOutputStream fos =null;
          try{
                fos= new FileOutputStream(\"city.txt\");
                fos.write(cities);
                fos.close();
            }catch(IOException e){}

    }
}

    Related Post:
  1. Program to ask question and accept answer up to 3 attempt and display right answer if it is wrong

  2. Encrypt the text that you want to send on the client side. The server side decrypts it after receiving. Append server time after each word in the sent

  3. Program that enabled applet calculator

  4. Program to show the use of Bitwise Operator (|) OR

  5. Program to perform Merge Sort

  6. Program to generate Fibonacci Series of a given number

  7. Word list program that reads a text file and makes an alphabetical list of all the words in that file. The list of words is output to another file

  8. Program that accepts a shopping list of items from the command line and stores them in a vector. Also provide facility to perform operation

  9. Create an interface coversions. Which have the following functions Inchestomillimeters(), hptowatts(),wattstohp(),poundstogram(),gramtopounds()

  10. Program to calculate the frequency for different values of C starting from 0.01 to 0.1 in steps of 0.01

  11. An applet program of linear sort

  12. Even no or Prime no?????

  13. Program to show an example of searching Strings for subStrings

  14. Program of creating a file using text fields in windows

  15. Program of reading and writing primitive data

  16. Program of insertion sort

  17. Develop a CORBA based application for addition of two complex numbers and displaying the result on client side

  18. Program to show the use of Logical or Boolean Negation i.e. NOT (!)

  19. Program to read command line arguments

  20. Program of storing and retrieving integers using data streams on a single file

 
 
Didn't find what you were looking for? Find more on Program of writing Bytes to a File