10. public class Foo implements java.io.Serializable { 11. private int x; 12. public int getX() { return x; } 12.publicFoo(int x){this.x=x; } 13. private void writeObject( ObjectOutputStream s) 14. throws IOException { 15. // insert code here 16. } 17. } Which code fragment, inserted at line 15, will allow Foo objects to be correctly serialized and deserialized?()
- A、 s.writeInt(x);
- B、 s.serialize(x);
- C、 s.writeObject(x);
- D、 s.defaultWriteObject();
正确答案:D
答案解析:有
微信扫一扫手机做题