範例
public
static
class
SerializableObject
implements
Serializable{
synchronized private
void
readObject(
ObjectInputStream
s)
throws
IOException, ClassNotFoundException {
s.defaultReadObject();
}
}
解決方案
宣告不含
synchronized
修飾元的 readObject()
public
static
class
SerializableObject
implements
Serializable{
private
void
readObject(
ObjectInputStream
s)
throws
IOException, ClassNotFoundException {
s.defaultReadObject();
}
}