Copy File in Java from One Location to Another
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");
}
}
0 Comments