import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class CopyBytes1 {
public static void main(String[] args) throws IOException {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream("c:\\aaa.txt");
out = new FileOutputStream("c:\\outagain.txt");
int c;
while ((c = in.read()) != -1) {
out.write(c);
}
} finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
}
}
我在c中保留了我的aaa.txt,但是當我編譯它的引發FileNotFoundException時。爲什麼要來?我應該在哪裏保存我的文件?以下代碼中的文件IO懷疑
在'c:'還是'c:\\'? – 2010-10-28 05:03:31
'編譯'時引發異常嗎? – rkg 2010-10-28 05:07:07
有什麼區別c:或C:\? – Sumithra 2010-10-28 05:07:22