题:
[Java] 纯文本查看 复制代码 public class Test1_6_1 {
public static void main(String[] args) throws IOException {
FileInputStream fis = null;
FileOutputStream fos = null;
try{
//1开流
fis = new FileInputStream("a.txt");
fos = new FileOutputStream("b.txt");
//定义一个变量,用于接收字节
int b = 0;
//循环,结束条件为读取结果为-1
while ((b = fis.read()) != -1) {
fos.write(b);
}
} finally {
try {
//关流
if (fis != null)
fis.close();
} finally {
if (fos != null)
fos.close();
}
}
}
}
这里就两者同时存在,希望听听你们的见解.
|