no compiling errors but it gives a weird error when i run it.
this is the error i get when i run it.
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at filecopier.main(filecopier.java:8)
Here is my code it's supposed to copt text from one file to another
import java.io.*;
class filecopier{
//this program copies text from one file to another
//the file names are read as command line arguments
publicstaticvoid main(String arg[]){
String f1n=arg[0];
String f2n=arg[1];
try{
DataInput f1 =new DataInputStream(new FileInputStream(f1n));
DataOutput f2 =new DataOutputStream(new
FileOutputStream(f2n));
String x =f1.readLine();
while (x!=null){
f2.writeBytes(x+"\r\n");
x=f1.readLine();
}//end while
}catch (Exception ex){String err=ex.toString() ;
System.out.println(err);}
}
}
what is wrong with it?

