IO,咋运行不出来
import java.io.*;
public class FileOutputStreamTest
{
public static void mian(String[] args)
{
FileInputStream fis=null;
try {
fis = new FileInputStream("FileOutputStreamTestTest.java");
} catch (
FileNotFoundException e) {
e.printStackTrace();
}
FileOutputStream fos=null;
try {
fos = new FileOutputStream("f:/copy.txt");
} catch (File
NotFoundException e) {
e.printStackTrace();
}
byte[] b =new byte[1024];
int hasRead =0;
try {
while((hasRead=fis.read(b))!=-1)
{
fos.write(b,0,hasRead);
}
} catch (
IOException e) {
e.printStackTrace();
}
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
------解决方案-------------------- 1,主函数是main,你写成了mian
2,fis = new FileInputStream("FileOutputStreamTestTest.java");应该指明文件所在的路径
------解决方案--------------------