import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
DataOutputStream dop=new DataOutputStream(new FileOutputStream("1.txt"));
dop.writeUTF("神奇的我");
dop.close();
DataInputStream dip=new DataInputStream(new FileInputStream("1.txt"));
String s=dip.readUTF();
System.out.println(s);
dip.close();
}
}
运行结果: