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 of an applet to illustrate BarChart

  2. Program to ask question and accept answer up to 3 attempt and display right answer if it is wrong

  3. corba program of client and a DNS server where given a URL the server sends back an IP address

  4. Program which creates an Array of character. Make one function with one argument as a character and that function throw a user defined exception

  5. Program to read bytes from a file

  6. Program of telnet server - client

  7. An applet program to give demo of getDocumentBase() and getCodeBase() methods

  8. CORBA PROGRAM TO GET THE HTML CODE FROM ANY URL

  9. Program to show the use of some Math Methods

  10. Program that will read real number from the keyboard and print the following output in one line: small Integer not less The Given Number Largest Int

  11. Program for Thread Priority

  12. Program to show the use of If Statement

  13. Program that takes a long sentence and a character from the client and count the occurrence of the character in the sentence at the server side

  14. An applet program to perform selection sort

  15. An applet program that display blinking rectangle

  16. Program of inventory management and demonstrating interactive input and output

  17. Program to find a factorial of a given number

  18. Define an array of ten String elements each containing an arbitrary string of the form “month/day/year”

  19. RMI based application, which reads a file with list of marks of student from a client, send it to server and find how many students having distinct

  20. Program which simulate the dictionary in java

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