Copy File in Java from One Location to Another

Copy File in Java from One Location to Another

Copy File in Java from One Location to Another


copy file in java from one location to another,how to copy files in java example,how to copy file in java,copy one file to another in java,copy console output to file in java



Copy.java


import java.io.*;
class copy
{
public Static void main(String args[]) throws IOException
{
FileInputStream fis =new FileInputStream("1.jpg");
FileOutputStream fos =new FileOutputStream("2.jpg");
byte b[] =new byte [fis.available()];
fis.read(b);
fos.write(b);
fos.close();
System.out.println("File successfully copied");
}
}


Post a Comment

0 Comments