Java Tutorial

 
 
 
 
import java.io.*;

class  CopyBytes
{
    public static void main(String[] args) 
    {
          FileInputStream fis = null;
          FileOutputStream fos = null;

          try{
               fis = new  FileInputStream(\"input.txt\");
               fos = new FileOutputStream(\"output.txt\");

               int ch;
               while((ch=fis.read())!=1){
                    fos.write(ch);
               }
             }catch(IOException e)
                {
                  System.out.println(e);
                  System.exit(-1);
                }
            finally{
                 try{
                       fos.close();
                       fis.close();
                 }
                 catch(IOException e){}
            }

    }
}

    Related Post:
  1. Program to compute the sum of the digits of a given integer number. eg: I/o=4 then O/p=4+3+2+1=10

  2. Program to sort the contents of an array using Bubble Sort

  3. Servlet which takes input from an HTML client page and calculates and outputs the premium amount

  4. Program in CORBA which takes a long sentence from the client (at least 7 words), passes to the server, server separates out each word

  5. Program to declare, initialize and print a 2D array of integers

  6. An applet program that displays random dot

  7. Program sets up a String variable containing a paragraph of text of your choice. Extract the words from the text and sort them into alphabetical order

  8. Program to compare Strings by compring successive corresponding characters, starting with the first character in each String

  9. Develop a simple calculator with addition, subtraction, multiplication and division capabilities, data collection from client side, executed on server

  10. Program to show an example of using user-defined package in a program

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

  12. File handling program to copy bytes from one file to another

  13. An applet program to display Horizontal Color Bar

  14. Program to search an element in an array using Linear Search

  15. An applet program to display Vertical Color Bar

  16. GUI application in java, which enter the details of a student and on the submit display the details of the student

  17. Socket program of multi client chat server

  18. An applet program of showing new document using showDocument(URL) method

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

  20. Program to show the use of Do-While Loop

 
 
Didn't find what you were looking for? Find more on File handling program to copy bytes from one file to another