Q 1) can some one tell me if class B is serializable? 2) is ther any method to check if class B is serializable RUNTIME 3) Inacse i find an instance of some class (say any class say class C0 non serializable, can i make is serlializable on RUNTIME?
“The difference between 'involvement' and 'commitment' is like an eggs-and-ham breakfast: the chicken was 'involved' - the pig was 'committed'.”
Joined: Sep 08, 2008
This isn't really a serialization problem it's a failing in your understanding of a fundamental object orientation concept: inheritance (IS-A relationships). You really need to have a solid undersatnding of this concept in order to pass the certification exam. Therefore, I would strongly advise reading/re-reading Chapter 2 in S&B.
As a hint to help you on your way Question a) is asking if B IS-A java.io.serializable [sic], this could be tested by creating an instance of class B and using the instanceof operator.
Joined: Mar 03, 2008
Thanks Jenkinson for the reply...
having class A serializable; we can not assume that Class B is also serializable ...
say class B extends class A and contains some attributes like Thread, OutputStream (which are not serializable objects), then class B would certainly not be serializable even if it extends A...
in the situation we were in, i was suppose to receive some derived object of class A (say class b/c/d) by external client which i was not having information of...
hence wanted to know if we have any runtime api to find out if object referred by the reference (base class reference to be more precise) is serializable or not...
anyway that situation is been handled in some other means...