[5385] in java-interest
read functions
daemon@ATHENA.MIT.EDU (Stan Guillory)
Wed Feb 7 11:49:01 1996
From: guillory@ncsa.uiuc.edu (Stan Guillory)
To: java-interest@java.sun.com
Date: Wed, 7 Feb 1996 08:59:47 -0600 (CST)
Hello,
Can anyone explain the output of the following program?
import java.io.*;
class ReadFloat {
public static void main (String args[]) throws java.io.IOException {
DataInputStream dis = new DataInputStream(System.in);
DataOutputStream dos = new DataOutputStream(System.out);
float fTest = dis.readFloat();
System.out.println("fTest = " + fTest);
dos.writeFloat(fTest);
String s = dis.readLine();
float f = Float.valueOf(s).floatValue();
System.out.println("f = " + f);
dos.writeFloat(fTest);
}
}
The output is:
=> 4.5
fTest = 1.62243e-007
4.5
=> 4.5
f = 4.5
4.5
Notice that the only one who seems to know what the heck readFloat()
is doing is writeFloat()!
Thanks,
Stanford S. Guillory
Technical Lead, NCSA Mosaic for Windows
NCSA Software Development Group
guillory@ncsa.uiuc.edu
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com