I understand that every class that implements the Serializable interface should declare its own serialVersionUID
. What value should it be?
Isn't there any possibility of the value be the same as an autogenerated one, which will conflict with it?
I understand that every class that implements the Serializable interface should declare its own serialVersionUID
. What value should it be?
Isn't there any possibility of the value be the same as an autogenerated one, which will conflict with it?
I believe this answer really helps.
According to the doc, if you set a serialVersionUID
for your class, then the runtime will not try to generate one for you, so there will be no conflict (you can set basically any long value you want in that field, there are no other restrictions stated in the doc)
Let me know if this helps.