本帖最后由 一步步 于 2013-11-12 18:12 编辑
package twenty_one;
import java.io.*;
public class four {
public static void main(String[] args)throws IOException {
//wr();
rd();
}
public static void wr()throws IOException
{
DataOutputStream dos=new DataOutputStream(new FileOutputStream("data.txt"));
dos.writeInt(233);
dos.writeDouble(435.978);
dos.writeBoolean(true);
dos.close();
}
public static void rd()throws IOException
{
DataInputStream dis=new DataInputStream(new FileInputStream("data.txt"));
int num=dis.readInt();
boolean b=dis.readBoolean();
double d=dis.readDouble();
System.out.println("num="+num+" "+"double="+d+" "+"boolean="+b);
dis.close();
}
}
这段代码显示结果为;num=233 double=4.706111111950509E285 boolean=true其中Double的之明显不对啊!谁能看出是哪里错了吗?
|