Everything in the title is in the title.
After "my name" is very happy in the output.
import java.io. *; Public class docile {public static zero chief (string [] args) {string file = "file.T.T."; String strue = "my name"; Int intb = 1; Double door = 2.5; Four chad = 'f'; {FileOutputStream fos = Try New FileOutputStream (file); DataOutputStream dos = new dataoutputstream (fos); Dos.writeUTF (strategy); // I do not know why it prints secretly after my name dos.writeInt (INTB); Dos.writeDouble (douc); Dos.writeChar (Chad); Dos.flush (); Dos.close (); } Hold (IOException e) {System.out.println ("IOException:" + E); }}} I'm not good, what do I remember? I'm just trying to learn DataOutputStream
The data output is to print the binary, not the text, and you must read a binary As a file, the fact is that you can read some portions of it as if it were text, it does not mean it.
I recommend that you do the following. All of these can be read as text.
Fwitter FW = new fir (file); PrintWriter PW = new print-vaitters (FW); Pw.println (strategy); Pw.println (INTB); Pw.println (douc); Pw.println (chad); Dos.close (); In short, if you combine binary and text, then you are likely to confuse yourself.
No comments:
Post a Comment