然后就可以了?
关键是,我再读出来之后,他们是什么样的情况。ObjectInputStream input = new ObjectInputStream(
new FileInputStream(  ) );
input.readObject());
之后,是否还存在a1.b1和a1.b1.c1,且不会变??

解决方案 »

  1.   

    十分感谢大家:
       如果我没理解错的话。象下面这样的东西。我只要分别保存。然后分别读取就可以了。
    还用不用再对在两个包含同一个A类引用的对象中都复职呢?class A implements Serializable
    {}class B implements Serializable
    {
      A a1 = new A();
    }class C implements Serializable
    {
       A a2 = B::a1;
    }
    How to save / read ? 
    save A,save b,sav c;
    read a ,read b, read c, and then ?? b.a1 = a; c.a1=a;??
      

  2.   

    看一看这个:试试
    FileOutputStream sream = new FileOutputStream("t.tmp");
    ObjectOutputStream p = new ObjectOutputStream(sream); p.writeInt(88888);
    p.writeObject("Today");
    p.writeObject(new Date()); p.flush();
    ostream.close();
      

  3.   

    抱歉,弟子太笨不懂楼上的意思,t.tmp的东西我看不懂。
    我只是想知道,在一个类里,定义了另一个类的引用,用不用两个类都保存。
    我试了试好像不用。
    是不是这样呢?