What happens if we try to Serialize a class where the super class implements Serializable ?

Since the super class implements Serializable then all the sub classes are Serializable by default. Consider the following Person class.

public class Person implements Serializable{
private final String name ;
public Person(String name) {
super ();
this .name = name ;
Now as Person is implementing Serializable, so all its children are by default Serializable. We do not need to implement the Serializable interface for its child classes. The following class is by default serializable as it extending the Person class which implements Serializable.

public class Employee extends Person{
private final Integer employeeId ;
public Employee(Integer employeeId,String name) {
super (name);
this .employeeId = employeeId;
public String toString() {
return "Employee [employeeId=" + employeeId + "]" ;