Java 创建文本内容
Java 创建文本内容
import java.io.FileWriter; import java.io.IOException; public class TestFile { public static void main(String[] args) { StringBuffer sb=new StringBuffer(); sb.append("12345\n"); sb.append("abcde\n"); sb.append("123.abc"); try { FileWriter fw=new FileWriter("c:/test.txt"); fw.write(sb.toString()); fw.close(); } catch (IOException e) { e.printStackTrace(); } } }