日期:2014-05-20 浏览次数:20844 次
package stream;
import java.io.IOException;
import java.io.FileWriter;
public class FileWriterTest {
public static void main(String[] args)
{
try
{
FileWriter fw = new FileWriter("D://demo/test.txt");
char c1 = 'a';
char c2 = '国';
char c3 = 'b';
fw.write((int)c1);
fw.write((int)c2);
fw.write((int)c3);
fw.close();
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
fw.write((int)c1 + "");
fw.write((int)c2 + "");
fw.write((int)c3 + "");
fw.write(String.valueOf((int) c1));
fw.write(String.valueOf((int) c2));
fw.write(String.valueOf((int) c3));