/**
* 演示Fileoutputstream 的使用
*/
package 文件读出;
imp ort java.io.*;
public class test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
File f=new File("d:/ff/bb.txt");
//字节输出流
FileOutputStream fos=null;
try {
fos=new FileOutputStream(f);
String s="haghfsajhgjshdjf";
//定义字节数组
//byte []bytes=new byte[1024];
//如何把string转化成byte数组
fos.write(s.getBytes());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
try {
fos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}