0
I already have some notion about the serialVersionUID representing the class version (in bytes form) very objectively. But the version number can or should be the same in different classes ?
0
I already have some notion about the serialVersionUID representing the class version (in bytes form) very objectively. But the version number can or should be the same in different classes ?
0
It may be the same or it may be different as explained in the following link:
https://blog.caelum.com.br/entendendo-o-serialversionuid/
By default JDK is in charge of validating and generating the serial Windows, but in some cases you want to control your version. class so that it is compatible with previous versions, it is interesting that you have control of this version. As is the version of . class, meaning it is a version for each . class, but not necessarily can be different from others.
How then should we proceed to choose a serialVersionUID appropriate? It is very simple: if that class is being born in this moment, you can afford to use a serialVersionUID, as an example:
public class Usuario implements Serializable {
private static final
long serialVersionUID = 1L; private String login;
}
Browser other questions tagged java serialization
You are not signed in. Login or sign up in order to post.
Thank you Gilvan, I read this article too. I just hadn’t gotten explicit that it could be the same.
– Raphael Silva