import java.io.FileWriter;
import java.io.IOException;
class FileWriterDemo04
{
public static void main(String[] args)
{
FileWriter fw = null;
try{
fw = new FileWriter("aaaa.txt");
fw.write("abcd\r\n");
fw.write("efgh\r\n");
fw.flush();
}catch(IOException e){
e.printStackTrace();
}finally
{
if(!(fw==null))
{
try
{
fw.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
}
}
|
|