可学答题网 > 问答 > SCJP程序员认证考试题库
目录: 标题| 题干| 答案| 搜索| 相关
问题

1. import java.io.*; 


1. import java.io.*;  2. public class Foo implements Serializable {  3. public int x, y;  4. public Foo( int x, int y) { this.x = x; this.y = y; }  5.  6. private void writeObject( ObjectOutputStream s)  7. throws IOException {  8. s.writeInt(x); s.writeInt(y)  9. }  10.  11. private void readObject( ObjectInputStream s)  12. throws IOException, ClassNotFoundException {  13.  14. // insert code here  15.  16. }  17. }  Which code, inserted at line 14, will allow this class to correctly serialize and deserialize?() 

  • A s.defaultReadObject();
  • B this = s.defaultReadObject();
  • C y = s.readInt(); x = s.readInt();
  • D x = s.readInt(); y = s.readInt();
参考答案
参考解析:
分类:SCJP程序员认证考试题库
相关推荐

1、import java.io.*;  public&e

import java.io.*; public class Forest implements Serializable { private Tree tree = new Tree();&...

2、1. import java.util.*;&ensp

1. import java.util.*; 2. 3. Class FindStuff { 4. public static void  main(String [] ar...

3、1. import java.util.*;&ensp

1. import java.util.*; 2. public class TestSet { 3. enum Example { ONE, TWO, THREE }&en...

4、1. import java.util.*;&ensp

1. import java.util.*; 2. class ForInTest { 3. static List list = new ArrayList(); 4.&ens...

5、1. import java.util.*;&ensp

1. import java.util.*; 2. class SubGen { 3. public static void main(String [] args) { 4...

6、import java.io.PrintWriter;&ensp

import java.io.PrintWriter; class DoFormat { public static void main(String [] args) {int x =&ens...