Hi guys, just thought of something interesting. If I had these two classes:
class A implements Serializable{
int a1;
int a2;
public void method(){
}
}
class B implements Serializable{
int a1;
int a2;
}
and serialized an instance of A, and then tried to deserialize it as an instance of B, would it work?
According to what I read, when serializing, java only stores the fields(the state of the instance) but no methods. so method() in class A wouldn't matter at all in serialization?
When deserializing, would java look at the field names to match them or how?
just thought this might be interesting.
Cheers,
Jing
Edited by: J.T on Feb 16, 2008 5:31 AM
Edited by: J.T on Feb 16, 2008 5:32 AM
Edited by: J.T on Feb 16, 2008 5:34 AM