?? filewritertest.java
字號:
import java.io.*;
/**
* Description:
* <br/>Copyright (C), 2005-2008, Yeeku.H.Lee
* <br/>This program is protected by copyright laws.
* <br/>Program Name:
* <br/>Date:
* @author Yeeku.H.Lee kongyeeku@163.com
* @version 1.0
*/
public class FileWriterTest
{
public static void main(String[] args) throws IOException
{
FileWriter fw = null;
try
{
//創建字符輸出流
fw = new FileWriter("poem.txt");
fw.write("錦瑟 - 李商隱\r\n");
fw.write("錦瑟無端五十弦,一弦一柱思華年。\r\n");
fw.write("莊生曉夢迷蝴蝶,望帝春心托杜鵑。\r\n");
fw.write("滄海月明珠有淚,藍田日暖玉生煙。\r\n");
fw.write("此情可待成追憶,只是當時已惘然。\r\n");
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
finally
{
//使用finally塊來關閉文件輸出流
if (fw != null)
{
fw.close();
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -