Copy file : File Management

FileInputStream and FileOutputStream classes both use for copy file concepts. FileInputStream class reads data from one file. FileOutputStream class writes into another file.


Video on copy file java program.

Program on copy to file to another file.


class io7


                public static void main(String args[]) throws IOException


                                BufferedReader br= new BufferedReader(new InputStreamReader(;

                                FileInputStream fin = null;

                                FileOutputStream fout = null;





                                                System.out.print(“Enter Original File : “);

                                                String orgFile = br.readLine();

                                                System.out.print(“Enter Copy to File Name : “);

                                                String cpyFile = br.readLine();


                                                fin = new FileInputStream(orgFile);

                                                fout = new FileOutputStream(cpyFile);


                                                int i;



                                                                i =; // read data from orgFile

                                                                fout.write(i); // write i data into cpyFile




                                catch(Exception ex){}




Enter Original File:

Enter Copy to File Name :


If you have any query on blog example, you can directly comment us or subscribe our website

Earn Money Online

1722total visits,2visits today


Hello, I am Maddy a Java blogger, trainer and developer

Related articles

Comments are closed.