Originally posted by Bob Ruth:
Just one more point of view on this:
1) Inheritance issue: if a superclass defines a variable and it is not defined with private access, then a subclass can reference it and modify it as if it had defined it itself.
2) Serialization issue: If a subclass is Serializable but the superclass is not: Then, when deserialized, the subclass constructor will NOT be run so that it's serialized variable maintain their "copied in" values. However, since the superclass was NOT serializable, it's constructor WILL be run and any variables that are defined and initialized in the superclass will be initialized and lose their "copied in" value.
One addition for 1 point: Super class's instance variables with the default access are not inherited by Sub classes which are in different package.
@Arun:
"Copied in" means the values which are copied during the serialization process.
[ October 01, 2008: Message edited by: M SRILATHA ]
[ October 01, 2008: Message edited by: M SRILATHA ]