当前位置: 代码迷 >> J2SE >> 简单有关问题,请进!
  详细解决方案

简单有关问题,请进!

热度:124   发布时间:2016-04-24 12:46:36.0
简单问题,请进!!
align=left]
FileOutputStream f=new FileOutputStream("F:\\通讯录\\information.txt",true);
ObjectOutputStream out=new ObjectOutputStream(f);
out.writeObject(al);
out.flush();
out.close();

[/align]

我用ObjectOutputStream把对象写入文本,但打开文本里面都是乱码,怎么回事啊?

------解决方案--------------------
你记事本打开乱码是正常的。
因为你部知道他怎么写一个对象到文件。
但是你可以用同样的方法读出来就可以了 。
Java code
public class TestObjectOutoutStream {        public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException {shM
  相关解决方案