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 "); sb.append("abcde "); sb.append("123.abc"); try { FileWriter fw=new FileWriter("c:/test.txt"); fw.write(sb.toString()); fw.close(); } catch (IOException e) { e.printStackTrace(); } } }