FileWriter fw=null ;
try
{
fw=new FileWriter("Demo.txt");
fw.write("abcdefghijkle");
}
catch(IOException e)
{
System.out.println(e.toString());
}
finally
{
try{
if(fw!=null)
fw.close();
}
catch(IOException e)
{
System.out.println(e.toString());
}
}
我想问的是,为什么filewriter一开始就要初始化为null,可以不初始化吗??? |
|