JAVA CODE FOR NODE STREAM-TO COPY FILE | URDINESH

Software Programming, Tutorials, Interview Preparations,Stock Market,BSE/NSE, General informations

Tuesday, May 20, 2014

JAVA CODE FOR NODE STREAM-TO COPY FILE



PROGRAM:

import java.io.*;
class FileCopy
{
            public static void main(String a[])throws IOException
{
                         byte b[]=new byte[100];
            FileInputStream fis=new FileInputStream("Test1.txt");
                        fis.read(b);
            FileOutputStream fos=new FileOutputStream("Test2.txt");
                        fos.write(b);
            System.out.println("\nFile has been Copied!.");
}
}


OUTPUT:

(i)Test1.txt:

Welcome to MCA lab
(ii)Test2.txt:

            Welcome to MCA lab


File has been Copied!.

No comments:

Post a Comment

Thanks for your valuable comments

Followers