java.io.NotSerializableException is thrown when the object is not eligible for the serialization. We must implement the Serializable interface to make the class eligible for the serialization. This is a marker interface which tells the JVM that the class can be serialized.
How to fix java.io.NotSerializableException?
Student class must implement the serializable interface.