[求助]空指针异常?
package HomeWork;import java.io.*;
public class CopyFile {
public static void main(String [] args)throws Exception{
while(!args[0].equals("copy")){
System.out.println("你输入的命令有误!");
}
new File(args[2]);
FileInputStream IFile=new FileInputStream(args[1]);
int temp;
temp=IFile.read(args[1].getBytes());
FileOutputStream OFile=new FileOutputStream(args[2]);
OFile.write(temp);
}
}
提示:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at HomeWork.CopyFile.main(CopyFile.java:5)
我想通过main方法能够传递参数,不知道是不是这样写的