多做题,通过考试没问题!

Java认证考试

睦霖题库>其他计算机考试>Java认证考试

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
答案解析:
进入题库查看解析

微信扫一扫手机做题