I have:
class MyClass extends MyClass2 implements Serializable { //... }
In MyClass2 is a property that is not serializable. How can I serialize (and de-serialize) this object?
Correction: MyClass2 is, of course, not an interface but a class.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As someone else noted, chapter 11 of Josh Bloch’s Effective Java is an indispensible resource on Java Serialization.
A couple points from that chapter pertinent to your question:
I’ve written a quick example below illustrating this.