Import the Java. IO. *;
Public class DataIO {
Public static void main (String [] args) throws IOException {
DataOutputStream out=
New DataOutputStream (
New BufferedOutputStream (
New FileOutputStream (" c: \ \ data. TXT ")));
Out. WriteBoolean (false);
Out. WriteChar (' c ');
Out. WriteByte (1);
Out. WriteShort (2);
Out. WriteInt (3);
Out. WriteLong (4 l);
Out. WriteFloat (5.0 f);
Out. WriteDouble (6.0);
Out. WriteUTF (" hello world!" );
out.close();
A DataInputStream in=new a DataInputStream (
New BufferedInputStream (new FileInputStream (" c:/data. TXT ")));
System. Out.println (in readBoolean () + ";" + in the readChar () + ";" );
System. Out.println (in readByte () + ";" + in readShort () + ";" );
System. Out.println (+ in readInt () + ";" + in readLong ());
System. Out.println (in readFloat () + ";" + in the readDouble () + ";" );
System. The out. Println (in readUTF ()); In the close ();
}
}
CodePudding user response:
This I also not too will be solved, please consult the original poster