考试题
Which piece of code will allow this class to be correctly serialzed and desirialized?
import java.io.*;
public class Car implements Serializable {
public int speeds;
public int wheels;
private void writeObject(ObjectOutputStream oos)
throws IOException {
oos.writeInt(speeds);
oos.writeInt(wheels);
}
private void readObject(ObjectInputStream ois)
throws IOException {
. . . . . . Place here . . . . . .
}
}
1.this = ois.defaultReadObject();
2.speeds = ois.readInt();
3.wheels = ois.readInt();
4.wheels = ois.readInt();
5.speeds = ois.readInt();
6.ois.defaultReadObject(); --------------------编程问答-------------------- Write a method that takes in a sentence and find the word that occurs the most. --------------------编程问答-------------------- 2,3
. --------------------编程问答-------------------- thank you! --------------------编程问答-------------------- --------------------编程问答-------------------- 你是Y2的还是S2的。代码看不懂。呵呵
补充:Java , Java SE