What happens if a superclass in Java does not implement Serializable but its subclass does?

1
The serialization process will fail as all ancestors must be Serializable.
2
The subclass can still be serialized, but the fields of the superclass are not serialized. 
3
The subclass inherits Serialization automatically, making the superclass fields Serializable. 
4
Only static fields of the superclass get serialized.

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation