Serializing child class if parent class does not implement serializable?

Viewed 9013
public class Employee2 extends Employee1 {} 

public class Employee1  extends Employee0 {}

public class Employee0  {}

Now i serialize the Employee2 class and

get the error  java.io.NotSerializableException: Employee2

Now if changed Employee1 class def to

public class Employee1  extends Employee0 implements java.io.Serializable {}

it works fine but please note Employee0 still does not implement Serializable

Is it mandatory for Base class has to implement Serializable to serialize the child class? If yes why its mandatory only for Employee1 but not for Employee0 ?

As per my example it looks like yes but as per other articles on net this should not be mandatory. So what i am missing here?

1 Answers
Related