IO编程练习

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class FileInputStream {
	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
        //文件名
		String str ="快乐十分钟";
		//创建对象
			FileOutputStream f = new FileOutputStream("hhhh");
		
		//写文件
		byte[] f1 = str.getBytes();
		int len = f1.length;
		for(int i=0;i<f1.length;i++){
			f.write(f1);
		}
		//关闭
		f.close();
		//读文件
		//创建对象
	}
      
posted on 2017-07-18 09:06  丿随缘  阅读(88)  评论(0编辑  收藏  举报