JAVA IO——DataInputStream 和DataOutputStream 读写文件

 DataInputStream 和DataOutputStream的使用

package pb.io.data;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * DataInputStream 和DataOutputStream的使用
 * @author TerryZhong
 *
 */
public class DataInputAndOutput {

	public static void main(String[] args) {
		try {
			FileOutputStream fos=new FileOutputStream("D:/test/newDoc.txt");
			DataOutputStream out=new DataOutputStream(new BufferedOutputStream(fos));
			float[]prices={105.5f,65.5f,59.5f};
			int[]amounts={10,15,22};
			String []names={"Java","Sql","Jsp"};
			for(int i=0;i

你可能感兴趣的:(Java入门篇,java,python,开发语言)