whenever I see this line of code
private static final long serialVersionUID =
it's always followed by some long serial number.. how is this number generated? If I wanted to randomly generate this value, how would I go about that? thanks for any help.
The JDK ships a tool called serialver
. You give it a classname and it will generate a serialVersionUID for you. For example:
$serialver java.lang.String
java.lang.String: private static final long serialVersionUID = -6849794470754667710L;
For the IntelliJ IDE, try: IntelliJ IDEA generating serialVersionUID
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With