我用的是 XmlEncoder 来保存的,但是为啥,key值时有值的,但是 value值为空,但是我调试了下 value不为空,还有别的序列化的方法吗,
另外 如果要序列化类,该类必须要实现Serilazable 接口吗

解决方案 »

  1.   

    这个java的序列化,不知道你用什么方法做的。里面的类必须要实现Serilazable 接口       FileOutputStream fos = new FileOutputStream("t.tmp");
          ObjectOutputStream oos = new ObjectOutputStream(fos);      oos.writeInt(12345);
          oos.writeObject("Today");
          oos.writeObject(new Date());      oos.close();
      

  2.   

    序列化必须实现Serilazable接口,还有静态的瞬态的不能被序列化 static , transient
      

  3.   

     虽然没太http://bbs.csdn.net/topics/390436297/close大帮助,还是给分了