IO编程__字节流__输出

 

一、代码如下

package www.tainiu.wenjian;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class ac__FileZjlOut__V1 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		//File f= new File("d:\\Test.txt");
		FileOutputStream fos= null;
		
		try {
			//fos= new FileOutputStream(f);
			fos= new FileOutputStream("d:\\Test.txt");
			String s= "kkljl\r\n";
			String s1= "中dd国好";
			fos.write(s.getBytes());
			fos.write(s1.getBytes());
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			try {fos.close();} catch (IOException e) {e.printStackTrace();}
		}

	}

}

 

posted @ 2017-10-06 22:22  18513757531  阅读(108)  评论(0编辑  收藏  举报