File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Serializable issues !! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply locked New topic

Serializable issues !!

K Abhijit
Ranch Hand

Joined: Mar 03, 2008
Posts: 88
class A implements

int memeberA ;

class B extends class A

int memeberC ;


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

Joined: Sep 08, 2008
Posts: 27
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 [sic], this could be tested by creating an instance of class B and using the instanceof operator.


K Abhijit
Ranch Hand

Joined: Mar 03, 2008
Posts: 88
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...


Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Serialization is no longer on the exam

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
K Abhijit
Ranch Hand

Joined: Mar 03, 2008
Posts: 88
was under wrong window of SCJP.
closing this; and opening a new thread @
I agree. Here's the link:
subject: Serializable issues !!
It's not a secret anymore!