import java.io.*;

public class DataOutputStreamTest {
	public static void main(String args[]) throws IOException {
		FileOutputStream fout=null;
		DataOutputStream dout=null;

		try{
			fout = new FileOutputStream("data.txt");
			dout = new DataOutputStream(fout);
		}catch(FileNotFoundException e){
			e.printStackTrace();
		}

		try{
			dout.writeDouble(12.3);
			dout.writeInt(5);
			dout.writeUTF("abc中国");
		}catch(IOException e){
			e.printStackTrace();
		}finally{
			dout.close();
			fout.close();//关闭顺序与建立顺序正好相反。
		}
	}
}
