package com.day1203.a;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class DateTest1 {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
//写入
DataOutputStream dao=new DataOutputStream(new FileOutputStream("b.txt"));
dao.writeInt(11);
dao.writeDouble(0.8776889);
dao.writeUTF("sjfal");
dao.writeBoolean(false);
dao.flush();
dao.close();
//读取
DataInputStream dis=new DataInputStream(new BufferedInputStream(new FileInputStream("b.txt")));
int a=dis.readInt();
System.out.println(a);
double b=dis.readDouble();
System.out.println(b);
String str=dis.readUTF();
System.out.println(str);
}
}
其中boolean类型的没有对其进行输出为什么运行时却没有出现异常 |
|