文件输出流FileOutputStream
作者:马育民 •
•
阅读:44
public class TestOutputStream {
public static void main(String[] args) {
// TODO Auto-generated method stub
FileOutputStream fos=null;
String s="测试输出流的使用方法!";
try {
fos=new FileOutputStream("C:/Users/mym/Desktop/测试输出流.txt");
fos.write(s.getBytes());
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally{
try {
if(fos!=null){
fos.close();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
原文出处:/show_1C7iam4iR0Q.html