FileOutputStream f=new FileOutputStream(new File(“sa.txt”));

DataOutputStream do=new DataOutputStream(f);

do.writeUTF(“字符串,可包含中文”);

do.writeInt(21);

do.writeDouble(32.43);

do.writeBoolean(true);

do.close();f.close();

//同理也有readUTF()、readBoolean()、readDouble()方法来读取相应数据。

版权声明:本文为riverer原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/riverer/p/2020_06_23_003.html