1. 程式人生 > >IO編程練習

IO編程練習

文件名 throw string exceptio stat stream pub 十分 logs

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();
		//讀文件
		//創建對象
	}
      

IO編程練習