How to generate serialVersionUID in Java?

In this article, we will learn how to generate serialVersionUID in Java in eclipse.

If you have already created class and that class implements Serializable interface, now its time to learn how to generate serialVersionUID for the class.

Hover your mouse on the class as shown below - 

Generate SerialVersionId

Now either you can select one of the following to generate serialVersionId.

  • Add default serial version ID.
    This will add following serialVersionId in your class - 
    private static final long serialVersionUID = 1L;
  • Add genrated serial version ID.
    This will add a random serialVersionId generated by Java.

In this article, we learnt how to generate serialVersionUID in Java using eclipse.

Article tagged as
Author
Author: Amit Gupta
Published On: 28/04/2017
Last revised On: 28/04/2017
View all articles by Amit Gupta

Share this post

Comments

Comments
comments powered by Disqus

Navigation

Social Media