Serializable issues !!

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'.”

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.

thanks

Graeme

K Abhijit
Ranch Hand

Joined: Mar 03, 2008
Posts: 88

posted Jan 16, 2010 07:05:58

0

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...