package lianxipackage.io流;
import java.io.*;
class copyDemo
{
public static void main(String[] args)
{
FileWriter fw = null;//提示main暂挂;此行的多个标记,调试当前指令指针
FileReader fr = null;
try
{
fw = new FileWriter ("danlishejimoshi-1.java");
fr = new FileReader ("danlishejimoshi.java");
int len = 0;
char[] buf = new char[1024];
while((len = fr.read(buf))!=-1)
{
fw.write(buf,0,len);
}
}
catch(IOException e)
{
throw new RuntimeException("复制失败");//提示暂挂,旧方法
}
finally
{
if(fr!=null)
try
{
fr.close();
}
catch(IOException e)
{
throw new RuntimeException("关闭错误");
}
if(fw!=null)
try
{
fw.close();
}
catch(IOException e)
{
throw new RuntimeException("关闭出错");
}
}
}}
有两个提示,都不明白,什么叫暂挂呢、 |