public static void main(String[] args) throws IOException {
// 实例化FileOutputStream对象,如果文件不存在,会创建文件
FileOutputStream fos = new FileOutputStream("d:/test/hello.txt");
String str = "内容,这里是内容!";
byte[] words = str.getBytes();
fos.write(words, 0, words.length);
// 关闭流
fos.close();
}
转载于:https://my.oschina.net/u/3468198/blog/893893